ModularMachinery Wiki(ZH)/机械结构到 JSON 转换工具 【进阶】
(将其定义为[进阶],是因为您应该知晓如何去自定义机器。并且我们强烈建议您在导出的JSON上修改。)
为一台复杂的机械编写JSON将会花费许多时间。同时您还有可能会出现错位、字词拼写错误等问题。为了避免这种情况,ModularMachinery添加了“建造选择工具”,允许玩家(在创造模式或op时)用这个工具选择方块并将其导出为JSON。
手持“建造选择工具”,对准方块右键单击(或左键单击以避免与某些方块产生交互)来将方块添加到当前的选择项,或者从当前选择项中删除这个方块。当方块(机械结构模块)被选中后,方块将会有“白色覆盖层”的效果,表明您已经选择了这个方块的位置。您可以破坏这个方块,或者在原处放置另一个方块,以便在选择工具中添加类似流体之类不可选中的东西。 (流体之类通常不能右键单击来选中)
一旦你选择了你想添加到结构/机械上的方块,你必须右键单击“机械控制器”来确认你的选择。记住,控制器的朝向非常重要!控制器所朝向的方向将被视为“正面”。无论控制器朝向哪里,它所朝向的地方都是机器的“正面”。因此,在用选择工具右键单击控制器前,一定要确保控制器朝向正确的位置。
之后,若一切顺利,机械将会以“machine--.json”的形式被保存在你的“machine”文件夹中,其他机械的文件也储存在这里。同时,保存之后,你之前的所有选择,将会被清除,以此来避免重复创建或不小心忘记取消选择。
接下来,需要进行"post-processing"。因为模组只把选定的方块以及它的 blockstate 序列化为metadata,并且保存到相应的json文件中。如果这个位置的方块有 tileentity,它的数据将会被序列化,并保存在相应的json文件中。如果文件中的方块已经有了tileentity,它的数据将被序列化并保存在相应的'nbt'-tag中。
- 除非你想与这个NBT-tag中的某些条目相适应,否则我们建议您完全删除'nbt'-specification。适当地调整每个位置的元素,这对于机器来说是合理的。
该导出机器的JSON文件只有“parts”-tags,目前只定义了多方块结构,还需添加"registryname"和"localizedname"等。
{
"parts": [
{
"x": -1,
"y": 0,
"z": 0,
"elements": [
"modularmachinery:blockfluidinputhatch"
]
},
{
"x": -1,
"y": 0,
"z": 1,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": 0,
"y": 0,
"z": 1,
"elements": [
"minecraft:water"
]
},
{
"x": 1,
"y": 0,
"z": 0,
"elements": [
"modularmachinery:blockinputbus"
]
},
{
"x": -1,
"y": 0,
"z": 2,
"elements": [
"modularmachinery:blockenergyoutputhatch"
]
},
{
"x": 1,
"y": 0,
"z": 1,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": 0,
"y": 0,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 1,
"y": 0,
"z": 2,
"elements": [
"modularmachinery:blockoutputbus"
]
},
{
"x": 1,
"y": -1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": 0,
"y": -1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": -1,
"y": 1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": -1,
"y": -1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": 0,
"y": 1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": -1,
"y": 1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 0,
"y": 1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 1,
"y": 1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": -1,
"y": 1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 0,
"y": 1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": 1,
"y": 1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": -1,
"y": -1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 1,
"y": 1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 0,
"y": -1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": -1,
"y": -1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 0,
"y": -1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 1,
"y": -1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 1,
"y": -1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
}
]}
样例 补全"registryname"和"localizedname"后:
{
"registryname": "ioMachine",
"localizedname": "Baka组装机",
"parts": [
{
"x": -1,
"y": 0,
"z": 0,
"elements": [
"modularmachinery:blockfluidinputhatch"
]
},
{
"x": -1,
"y": 0,
"z": 1,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": 0,
"y": 0,
"z": 1,
"elements": [
"minecraft:water"
]
},
{
"x": 1,
"y": 0,
"z": 0,
"elements": [
"modularmachinery:blockinputbus"
]
},
{
"x": -1,
"y": 0,
"z": 2,
"elements": [
"modularmachinery:blockenergyoutputhatch"
]
},
{
"x": 1,
"y": 0,
"z": 1,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": 0,
"y": 0,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 1,
"y": 0,
"z": 2,
"elements": [
"modularmachinery:blockoutputbus"
]
},
{
"x": 1,
"y": -1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": 0,
"y": -1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": -1,
"y": 1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": -1,
"y": -1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": 0,
"y": 1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": -1,
"y": 1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 0,
"y": 1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 1,
"y": 1,
"z": 0,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": -1,
"y": 1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 0,
"y": 1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@1"
]
},
{
"x": 1,
"y": 1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": -1,
"y": -1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 1,
"y": 1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 0,
"y": -1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": -1,
"y": -1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 0,
"y": -1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 1,
"y": -1,
"z": 1,
"elements": [
"modularmachinery:blockcasing@0"
]
},
{
"x": 1,
"y": -1,
"z": 2,
"elements": [
"modularmachinery:blockcasing@0"
]
}
]}
Tr:Citysands