A Java Mindustry mod library which provides support for non-square blocks implementation for json mod.
Currently, this mod provided Multi-Block version of the following types:
GenericCrafter-MultiBlock-GenericCrafter.AttributeCrafter-MultiBlock-AttributeCrafter.
it provided some new field:
linkValues- Control the shape of the crafter. integer array.rotations- Rotation of the block when flipped. integer array.canMirror- Does the block has a mirrored version. boolean value.
also, this mod provided several new drawer to adapt the Multi-Block:
DrawFlameRotated- DrawFlame but the sprite rotates with the block. also can set the flame position.DrawLiquidRegionRotated- DrawLiquid, sprite rotate with the block's rotation.DrawRegionCenterSymmetry- Draw sprite0 when rotation = 0 or 2 and sprite1 when rotation = 1 or 3.DrawRegionRotated- Draw sprites according to its rotation. need 4 sprite with different shading.
[1] First you need to know the center tile of a block:
- For odd size block, the center tile is right its center.
- For even size block, the center tile is the bottom right tile among the center 4 tiles.
- You can check the center tile (surge wall) for blocks form size 1 to 8 in the below image.
[2] Figure the shape of the block you want.
- In this step, you can just simply consider the Multi-Block structure as container/vault attached to core. You can simply place some blocks in game and get the shape you want and then divide the shape with several rects.
- The example is below. The left copper wall struct are wanted shape, the right are divided rects
(two 2x2 titanium wall rect & one 3*3 thorium shape). Choose one rect as the
CenterEntity(in this case the thorium is the best choice). The other rects are considered asLinkEntityto the center rect.
- Calculate the
linkValues. As mentioned above, find eachLinkEntity's center tile, and get the relative position to theCenterEntity's center tile. in this example they are <-1, 2> and <2, -1>. Append theLinkEntity's size after the position: [-1, 2, 2] & [2, -1, 2]. combine them and get the finallinkValues: [-1, 2, 2, 2, -1, 2] (Notice: In no particular order)
[3] Write the JSON file
{
"type": "MultiBlock-GenericCrafter",
"canMirror": false,
"linkValues": [2, 0, 1, 2, 1, 1, -1, 0, 1, -1, 1, 1],
"rotations": [0, 1, 2, 3, 0, 1, 2, 3],
"size": 2,
"category": "crafting",
"requirements": [
{ "item": "copper", "amount": 50 },
{ "item": "lead", "amount": 40 }
],
"hasPower": true,
"craftTime": 40,
"outputItem": { "item": "silicon", "amount": 2 },
"consumes": {
"power": 1,
"items": [
{ "item": "coal", "amount": 2 },
{ "item": "sand", "amount": 4 }
]
},
"craftEffect": "smeltsmoke",
"ambientSound": "smelter",
"ambientSoundVolume": 0.07,
"drawer": {
"type": "DrawMulti",
"drawers": [
{
"type": "DrawRegionCenterSymmetry",
"suffix": "-rot"
},
{
"type": "DrawFlameRotated",
"suffix": "-top-1",
"flameRadius": 2.2,
"flameRadiusIn": 1.5,
"x": 0,
"y": 0,
"flameX": -8,
"flameY": 0
},
{
"type": "DrawFlameRotated",
"suffix": "-top-2",
"flameRadius": 2.2,
"flameRadiusIn": 1.5,
"x": 0,
"y": 0,
"flameX": 8,
"flameY": 0
},
{
"type": "DrawRegionCenterSymmetry",
"suffix": "-top-rot"
},
{
"type": "DrawFlameRotated",
"suffix": "-top-0",
"x": 0,
"y": 0,
"flameX": 0,
"flameY": 0
}
]
}
}That's it, load the JSON in your mod and it should work properly.
Also check the Template for more examples.
Hope this library can help your json modding a lot. If you find this library helping, consider star this repo? >_<


