-
Notifications
You must be signed in to change notification settings - Fork 3
Example
Pearl edited this page Mar 3, 2024
·
5 revisions
BlockCrafting.addMultiblockStructure(MultiblockStructureBuilder.create("test:multi1")
.pattern("ddd", "ggg")
.pattern("ddd", "ggg")
.pattern("pds", "gdg")
.center("s", Blocks.STONE)
.whereCond("d", b => b == Blocks.DIRT)
.where("g", Blocks.GRASS_BLOCK)
.whereTag("p", "minecraft:planks")
.craftingItem("minecraft:stick")
.resultItem("2x minecraft:diamond")
.resultItem(Item.of("minecraft:golden_sword", "{Unbreakable:1b}"))
.build());
BlockCrafting.addMultiblockStructure(MultiblockStructureFileBuilder.create("test:multi2")
.file("structures/filetest.nbt")
.center(Blocks.OAK_LOG)
.craftingItemCond(i => i == Items.STICK)
.resultItem("100x minecraft:diamond")
.build());
BlockCrafting.addMultiblockStructure(MultiblockStructureBuilder.create("test:multi3")
.pattern("d", "s")
.center("s", "minecraft:granite")
.where("d", "minecraft:dirt")
.craftingItemTag("forge:ingots")
.resultItem(Item.of("minecraft:acacia_boat", 2), "minecraft:stick")
.resultEntity("minecraft:blaze")
.resultAction((level, pos, player) => {
var item = player.getMainHandItem();
player.setMainHandItem(item.copyWithCount(item.getCount() - 1));
level.setDayTime(0);
})
.build());In the structure defined in the first example, the first (bottom) layer is:
ddd
ddd
dds
The second layer is:
ggg
ggg
gdg
The structure in the second example is defined in the file structures/filetest.nbt.