the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 63 lines 2.1 kB view raw
1#include "stdafx.h" 2#include "..\..\..\Minecraft.World\StringHelpers.h" 3#include "StartFeature.h" 4 5StartFeature::StartFeature() 6{ 7 m_chunkX = 0; 8 m_chunkZ = 0; 9 m_orientation = 0; 10 m_feature = StructureFeature::eFeature_Temples; 11} 12 13void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs) 14{ 15 GameRuleDefinition::writeAttributes(dos, numAttrs + 4); 16 17 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX); 18 dos->writeUTF(_toString(m_chunkX)); 19 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkZ); 20 dos->writeUTF(_toString(m_chunkZ)); 21 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature); 22 dos->writeUTF(_toString((int)m_feature)); 23 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation); 24 dos->writeUTF(_toString(m_orientation)); 25} 26 27void StartFeature::addAttribute(const wstring &attributeName, const wstring &attributeValue) 28{ 29 if(attributeName.compare(L"chunkX") == 0) 30 { 31 int value = _fromString<int>(attributeValue); 32 m_chunkX = value; 33 app.DebugPrintf("StartFeature: Adding parameter chunkX=%d\n",m_chunkX); 34 } 35 else if(attributeName.compare(L"chunkZ") == 0) 36 { 37 int value = _fromString<int>(attributeValue); 38 m_chunkZ = value; 39 app.DebugPrintf("StartFeature: Adding parameter chunkZ=%d\n",m_chunkZ); 40 } 41 else if(attributeName.compare(L"orientation") == 0) 42 { 43 int value = _fromString<int>(attributeValue); 44 m_orientation = value; 45 app.DebugPrintf("StartFeature: Adding parameter orientation=%d\n",m_orientation); 46 } 47 else if(attributeName.compare(L"feature") == 0) 48 { 49 int value = _fromString<int>(attributeValue); 50 m_feature = (StructureFeature::EFeatureTypes)value; 51 app.DebugPrintf("StartFeature: Adding parameter feature=%d\n",m_feature); 52 } 53 else 54 { 55 GameRuleDefinition::addAttribute(attributeName, attributeValue); 56 } 57} 58 59bool StartFeature::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation) 60{ 61 if(orientation != NULL) *orientation = m_orientation; 62 return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature; 63}