the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "XboxStructureActionGenerateBox.h"
3#include "..\..\..\Minecraft.World\StringHelpers.h"
4#include "..\..\..\Minecraft.World\net.minecraft.world.level.levelgen.structure.h"
5
6XboxStructureActionGenerateBox::XboxStructureActionGenerateBox()
7{
8 m_x0 = m_y0 = m_z0 = m_x1 = m_y1 = m_z1 = m_edgeTile = m_fillTile = 0;
9 m_skipAir = false;
10}
11
12void XboxStructureActionGenerateBox::writeAttributes(DataOutputStream *dos, UINT numAttrs)
13{
14 ConsoleGenerateStructureAction::writeAttributes(dos, numAttrs + 9);
15
16 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x0);
17 dos->writeUTF(_toString(m_x0));
18 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y0);
19 dos->writeUTF(_toString(m_y0));
20 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z0);
21 dos->writeUTF(_toString(m_z0));
22
23 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x1);
24 dos->writeUTF(_toString(m_x1));
25 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y1);
26 dos->writeUTF(_toString(m_y1));
27 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z1);
28 dos->writeUTF(_toString(m_z1));
29
30 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_edgeTile);
31 dos->writeUTF(_toString(m_edgeTile));
32 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_fillTile);
33 dos->writeUTF(_toString(m_fillTile));
34 ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_skipAir);
35 dos->writeUTF(_toString(m_skipAir));
36}
37
38void XboxStructureActionGenerateBox::addAttribute(const wstring &attributeName, const wstring &attributeValue)
39{
40 if(attributeName.compare(L"x0") == 0)
41 {
42 int value = _fromString<int>(attributeValue);
43 m_x0 = value;
44 app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter x0=%d\n",m_x0);
45 }
46 else if(attributeName.compare(L"y0") == 0)
47 {
48 int value = _fromString<int>(attributeValue);
49 m_y0 = value;
50 app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter y0=%d\n",m_y0);
51 }
52 else if(attributeName.compare(L"z0") == 0)
53 {
54 int value = _fromString<int>(attributeValue);
55 m_z0 = value;
56 app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter z0=%d\n",m_z0);
57 }
58 else if(attributeName.compare(L"x1") == 0)
59 {
60 int value = _fromString<int>(attributeValue);
61 m_x1 = value;
62 app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter x1=%d\n",m_x1);
63 }
64 else if(attributeName.compare(L"y1") == 0)
65 {
66 int value = _fromString<int>(attributeValue);
67 m_y1 = value;
68 app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter y1=%d\n",m_y1);
69 }
70 else if(attributeName.compare(L"z1") == 0)
71 {
72 int value = _fromString<int>(attributeValue);
73 m_z1 = value;
74 app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter z1=%d\n",m_z1);
75 }
76 else if(attributeName.compare(L"edgeTile") == 0)
77 {
78 int value = _fromString<int>(attributeValue);
79 m_edgeTile = value;
80 app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter edgeTile=%d\n",m_edgeTile);
81 }
82 else if(attributeName.compare(L"fillTile") == 0)
83 {
84 int value = _fromString<int>(attributeValue);
85 m_fillTile = value;
86 app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter fillTile=%d\n",m_fillTile);
87 }
88 else if(attributeName.compare(L"skipAir") == 0)
89 {
90 if(attributeValue.compare(L"true") == 0) m_skipAir = true;
91 app.DebugPrintf("XboxStructureActionGenerateBox: Adding parameter skipAir=%s\n",m_skipAir?"TRUE":"FALSE");
92 }
93 else
94 {
95 GameRuleDefinition::addAttribute(attributeName, attributeValue);
96 }
97}
98
99bool XboxStructureActionGenerateBox::generateBoxInLevel(StructurePiece *structure, Level *level, BoundingBox *chunkBB)
100{
101 app.DebugPrintf("XboxStructureActionGenerateBox - generating a box\n");
102 structure->generateBox(level,chunkBB,m_x0,m_y0,m_z0,m_x1,m_y1,m_z1,m_edgeTile,m_fillTile,m_skipAir);
103 return true;
104}