This commit is contained in:
Frank 2021-10-18 19:38:31 +02:00
parent a52b18ba9b
commit 073b473840
2 changed files with 387 additions and 361 deletions

View file

@ -1,7 +1,12 @@
package ru.bclib.api; package ru.bclib.api;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import net.fabricmc.fabric.api.tag.TagRegistry; import net.fabricmc.fabric.api.tag.TagRegistry;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -18,10 +23,6 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import ru.bclib.BCLib; import ru.bclib.BCLib;
import java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
public class TagAPI { public class TagAPI {
private static final Map<ResourceLocation, Set<ResourceLocation>> TAGS_BLOCK = Maps.newConcurrentMap(); private static final Map<ResourceLocation, Set<ResourceLocation>> TAGS_BLOCK = Maps.newConcurrentMap();
private static final Map<ResourceLocation, Set<ResourceLocation>> TAGS_ITEM = Maps.newConcurrentMap(); private static final Map<ResourceLocation, Set<ResourceLocation>> TAGS_ITEM = Maps.newConcurrentMap();
@ -33,9 +34,14 @@ public class TagAPI {
public static final Tag.Named<Block> BLOCK_END_GROUND = makeBlockTag(BCLib.MOD_ID, "end_ground"); public static final Tag.Named<Block> BLOCK_END_GROUND = makeBlockTag(BCLib.MOD_ID, "end_ground");
public static final Tag.Named<Block> BLOCK_CHEST = makeCommonBlockTag("chest"); public static final Tag.Named<Block> BLOCK_CHEST = makeCommonBlockTag("chest");
public static final Tag.Named<Block> BLOCK_WOODEN_CHEST = makeCommonBlockTag("wooden_chests");
public static final Tag.Named<Block> BLOCK_BARREL = makeCommonBlockTag("barrel");
public static final Tag.Named<Block> BLOCK_WOODEN_BARREL = makeCommonBlockTag("wooden_barrels");
public static final Tag.Named<Block> BLOCK_END_STONES = makeCommonBlockTag("end_stones"); public static final Tag.Named<Block> BLOCK_END_STONES = makeCommonBlockTag("end_stones");
public static final Tag.Named<Block> BLOCK_NETHER_STONES = makeCommonBlockTag("nether_stones"); public static final Tag.Named<Block> BLOCK_NETHER_STONES = makeCommonBlockTag("nether_stones");
public static final Tag.Named<Block> BLOCK_WORKBENCHES = makeCommonBlockTag("workbenches"); public static final Tag.Named<Block> BLOCK_WORKBENCHES = makeCommonBlockTag("workbench");
public static final Tag.Named<Block> BLOCK_SAPLINGS = makeCommonBlockTag("saplings");
public static final Tag.Named<Block> BLOCK_LEAVES = makeCommonBlockTag("leaves");
public static final Tag.Named<Block> BLOCK_DRAGON_IMMUNE = getMCBlockTag("dragon_immune"); public static final Tag.Named<Block> BLOCK_DRAGON_IMMUNE = getMCBlockTag("dragon_immune");
@ -46,11 +52,17 @@ public class TagAPI {
// Item Tags // Item Tags
public static final Tag.Named<Item> ITEM_CHEST = makeCommonItemTag("chest"); public static final Tag.Named<Item> ITEM_CHEST = makeCommonItemTag("chest");
public static final Tag.Named<Item> ITEM_WOODEN_CHEST = makeCommonItemTag("wooden_chests");
public static final Tag.Named<Item> ITEM_BARREL = makeCommonItemTag("barrel");
public static final Tag.Named<Item> ITEM_WOODEN_BARREL = makeCommonItemTag("wooden_barrels");
public static final Tag.Named<Item> ITEM_IRON_INGOTS = makeCommonItemTag("iron_ingots"); public static final Tag.Named<Item> ITEM_IRON_INGOTS = makeCommonItemTag("iron_ingots");
public static final Tag.Named<Item> ITEM_FURNACES = makeCommonItemTag("furnaces"); public static final Tag.Named<Item> ITEM_FURNACES = makeCommonItemTag("furnaces");
public static final Tag.Named<Item> ITEM_WORKBENCHES = makeCommonItemTag("workbenches"); public static final Tag.Named<Item> ITEM_WORKBENCHES = makeCommonItemTag("workbench");
public final static Tag.Named<Item> ITEM_HAMMERS = makeCommonItemTag("hammers"); public final static Tag.Named<Item> ITEM_HAMMERS = makeCommonItemTag("hammers");
public static final Tag.Named<Item> ITEM_SAPLINGS = makeCommonItemTag("saplings");
public static final Tag.Named<Item> ITEM_LEAVES = makeCommonItemTag("leaves");
/** /**
* Get or create {@link Tag.Named}. * Get or create {@link Tag.Named}.
* *

View file

@ -39,358 +39,372 @@ import ru.bclib.complexmaterials.entry.RecipeEntry;
import ru.bclib.recipes.GridRecipe; import ru.bclib.recipes.GridRecipe;
public class WoodenComplexMaterial extends ComplexMaterial { public class WoodenComplexMaterial extends ComplexMaterial {
public static final ResourceLocation MATERIAL_ID = BCLib.makeID("wooden_material"); public static final ResourceLocation MATERIAL_ID = BCLib.makeID("wooden_material");
public static final String BLOCK_CRAFTING_TABLE = "crafting_table"; public static final String BLOCK_CRAFTING_TABLE = "crafting_table";
public static final String BLOCK_STRIPPED_BARK = "stripped_bark"; public static final String BLOCK_STRIPPED_BARK = "stripped_bark";
public static final String BLOCK_STRIPPED_LOG = "stripped_log"; public static final String BLOCK_STRIPPED_LOG = "stripped_log";
public static final String BLOCK_PRESSURE_PLATE = "plate"; public static final String BLOCK_PRESSURE_PLATE = "plate";
public static final String BLOCK_BOOKSHELF = "bookshelf"; public static final String BLOCK_BOOKSHELF = "bookshelf";
public static final String BLOCK_COMPOSTER = "composter"; public static final String BLOCK_COMPOSTER = "composter";
public static final String BLOCK_TRAPDOOR = "trapdoor"; public static final String BLOCK_TRAPDOOR = "trapdoor";
public static final String BLOCK_BARREL = "barrel"; public static final String BLOCK_BARREL = "barrel";
public static final String BLOCK_BUTTON = "button"; public static final String BLOCK_BUTTON = "button";
public static final String BLOCK_LADDER = "ladder"; public static final String BLOCK_LADDER = "ladder";
public static final String BLOCK_PLANKS = "planks"; public static final String BLOCK_PLANKS = "planks";
public static final String BLOCK_STAIRS = "stairs"; public static final String BLOCK_STAIRS = "stairs";
public static final String BLOCK_CHEST = "chest"; public static final String BLOCK_CHEST = "chest";
public static final String BLOCK_FENCE = "fence"; public static final String BLOCK_FENCE = "fence";
public static final String BLOCK_BARK = "bark"; public static final String BLOCK_BARK = "bark";
public static final String BLOCK_DOOR = "door"; public static final String BLOCK_DOOR = "door";
public static final String BLOCK_GATE = "gate"; public static final String BLOCK_GATE = "gate";
public static final String BLOCK_SIGN = "sign"; public static final String BLOCK_SIGN = "sign";
public static final String BLOCK_SLAB = "slab"; public static final String BLOCK_SLAB = "slab";
public static final String BLOCK_LOG = "log"; public static final String BLOCK_LOG = "log";
public static final String TAG_LOGS = "logs"; public static final String TAG_LOGS = "logs";
public final MaterialColor planksColor; public final MaterialColor planksColor;
public final MaterialColor woodColor; public final MaterialColor woodColor;
public WoodenComplexMaterial(String modID, String baseName, String receipGroupPrefix, MaterialColor woodColor, MaterialColor planksColor) { public WoodenComplexMaterial(String modID, String baseName, String receipGroupPrefix, MaterialColor woodColor, MaterialColor planksColor) {
super(modID, baseName, receipGroupPrefix); super(modID, baseName, receipGroupPrefix);
this.planksColor = planksColor; this.planksColor = planksColor;
this.woodColor = woodColor; this.woodColor = woodColor;
} }
@Override @Override
protected FabricBlockSettings getBlockSettings() { protected FabricBlockSettings getBlockSettings() {
return FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).materialColor(planksColor); return FabricBlockSettings.copyOf(Blocks.OAK_PLANKS)
} .materialColor(planksColor);
}
@Override
public ResourceLocation getMaterialID() { @Override
return MATERIAL_ID; public ResourceLocation getMaterialID() {
} return MATERIAL_ID;
}
@Override
protected void initTags() { @Override
addBlockTag(TagAPI.makeBlockTag(getModID(), getBaseName() + "_logs")); protected void initTags() {
addItemTag(TagAPI.makeItemTag(getModID(), getBaseName() + "_logs")); addBlockTag(TagAPI.makeBlockTag(getModID(), getBaseName() + "_logs"));
} addItemTag(TagAPI.makeItemTag(getModID(), getBaseName() + "_logs"));
}
@Override
protected void initDefault(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) { @Override
initBase(blockSettings, itemSettings); protected void initDefault(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
initStorage(blockSettings, itemSettings); initBase(blockSettings, itemSettings);
initDecorations(blockSettings, itemSettings); initStorage(blockSettings, itemSettings);
} initDecorations(blockSettings, itemSettings);
}
final protected void initBase(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
Tag.Named<Block> tagBlockLog = getBlockTag(TAG_LOGS); final protected void initBase(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
Tag.Named<Item> tagItemLog = getItemTag(TAG_LOGS); Tag.Named<Block> tagBlockLog = getBlockTag(TAG_LOGS);
Tag.Named<Item> tagItemLog = getItemTag(TAG_LOGS);
addBlockEntry(
new BlockEntry(BLOCK_STRIPPED_LOG, (complexMaterial, settings) -> { addBlockEntry(
return new BaseRotatedPillarBlock(settings); new BlockEntry(BLOCK_STRIPPED_LOG, (complexMaterial, settings) -> {
}) return new BaseRotatedPillarBlock(settings);
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog) })
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog) .setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
); .setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
addBlockEntry( );
new BlockEntry(BLOCK_STRIPPED_BARK, (complexMaterial, settings) -> { addBlockEntry(
return new BaseBarkBlock(settings); new BlockEntry(BLOCK_STRIPPED_BARK, (complexMaterial, settings) -> {
}) return new BaseBarkBlock(settings);
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog) })
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog) .setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
); .setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
);
addBlockEntry(
new BlockEntry(BLOCK_LOG, (complexMaterial, settings) -> { addBlockEntry(
return new BaseStripableLogBlock(woodColor, getBlock(BLOCK_STRIPPED_LOG)); new BlockEntry(BLOCK_LOG, (complexMaterial, settings) -> {
}) return new BaseStripableLogBlock(woodColor, getBlock(BLOCK_STRIPPED_LOG));
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog) })
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog) .setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
); .setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
addBlockEntry( );
new BlockEntry(BLOCK_BARK, (complexMaterial, settings) -> { addBlockEntry(
return new StripableBarkBlock(woodColor, getBlock(BLOCK_STRIPPED_BARK)); new BlockEntry(BLOCK_BARK, (complexMaterial, settings) -> {
}) return new StripableBarkBlock(woodColor, getBlock(BLOCK_STRIPPED_BARK));
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog) })
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog) .setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
); .setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
addBlockEntry(new BlockEntry(BLOCK_PLANKS, (complexMaterial, settings) -> { );
return new BaseBlock(settings); addBlockEntry(new BlockEntry(BLOCK_PLANKS, (complexMaterial, settings) -> {
}).setBlockTags(BlockTags.PLANKS).setItemTags(ItemTags.PLANKS)); return new BaseBlock(settings);
}).setBlockTags(BlockTags.PLANKS)
addBlockEntry(new BlockEntry(BLOCK_STAIRS, (complexMaterial, settings) -> { .setItemTags(ItemTags.PLANKS));
return new BaseStairsBlock(getBlock(BLOCK_PLANKS));
}).setBlockTags(BlockTags.WOODEN_STAIRS, BlockTags.STAIRS).setItemTags(ItemTags.WOODEN_STAIRS, ItemTags.STAIRS)); addBlockEntry(new BlockEntry(BLOCK_STAIRS, (complexMaterial, settings) -> {
addBlockEntry(new BlockEntry(BLOCK_SLAB, (complexMaterial, settings) -> { return new BaseStairsBlock(getBlock(BLOCK_PLANKS));
return new BaseSlabBlock(getBlock(BLOCK_PLANKS)); }).setBlockTags(BlockTags.WOODEN_STAIRS, BlockTags.STAIRS)
}).setBlockTags(BlockTags.WOODEN_SLABS, BlockTags.SLABS).setItemTags(ItemTags.WOODEN_SLABS, ItemTags.SLABS)); .setItemTags(ItemTags.WOODEN_STAIRS, ItemTags.STAIRS));
addBlockEntry(new BlockEntry(BLOCK_FENCE, (complexMaterial, settings) -> { addBlockEntry(new BlockEntry(BLOCK_SLAB, (complexMaterial, settings) -> {
return new BaseFenceBlock(getBlock(BLOCK_PLANKS)); return new BaseSlabBlock(getBlock(BLOCK_PLANKS));
}).setBlockTags(BlockTags.FENCES, BlockTags.WOODEN_FENCES).setItemTags(ItemTags.FENCES, ItemTags.WOODEN_FENCES)); }).setBlockTags(BlockTags.WOODEN_SLABS, BlockTags.SLABS)
addBlockEntry(new BlockEntry(BLOCK_GATE, (complexMaterial, settings) -> { .setItemTags(ItemTags.WOODEN_SLABS, ItemTags.SLABS));
return new BaseGateBlock(getBlock(BLOCK_PLANKS)); addBlockEntry(new BlockEntry(BLOCK_FENCE, (complexMaterial, settings) -> {
}).setBlockTags(BlockTags.FENCE_GATES)); return new BaseFenceBlock(getBlock(BLOCK_PLANKS));
addBlockEntry(new BlockEntry(BLOCK_BUTTON, (complexMaterial, settings) -> { }).setBlockTags(BlockTags.FENCES, BlockTags.WOODEN_FENCES)
return new BaseWoodenButtonBlock(getBlock(BLOCK_PLANKS)); .setItemTags(ItemTags.FENCES, ItemTags.WOODEN_FENCES));
}).setBlockTags(BlockTags.BUTTONS, BlockTags.WOODEN_BUTTONS).setItemTags(ItemTags.BUTTONS, ItemTags.WOODEN_BUTTONS)); addBlockEntry(new BlockEntry(BLOCK_GATE, (complexMaterial, settings) -> {
addBlockEntry(new BlockEntry(BLOCK_PRESSURE_PLATE, (complexMaterial, settings) -> { return new BaseGateBlock(getBlock(BLOCK_PLANKS));
return new WoodenPressurePlateBlock(getBlock(BLOCK_PLANKS)); }).setBlockTags(BlockTags.FENCE_GATES));
}).setBlockTags(BlockTags.PRESSURE_PLATES, BlockTags.WOODEN_PRESSURE_PLATES).setItemTags(ItemTags.WOODEN_PRESSURE_PLATES)); addBlockEntry(new BlockEntry(BLOCK_BUTTON, (complexMaterial, settings) -> {
addBlockEntry(new BlockEntry(BLOCK_TRAPDOOR, (complexMaterial, settings) -> { return new BaseWoodenButtonBlock(getBlock(BLOCK_PLANKS));
return new BaseTrapdoorBlock(getBlock(BLOCK_PLANKS)); }).setBlockTags(BlockTags.BUTTONS, BlockTags.WOODEN_BUTTONS)
}).setBlockTags(BlockTags.TRAPDOORS, BlockTags.WOODEN_TRAPDOORS).setItemTags(ItemTags.TRAPDOORS, ItemTags.WOODEN_TRAPDOORS)); .setItemTags(ItemTags.BUTTONS, ItemTags.WOODEN_BUTTONS));
addBlockEntry(new BlockEntry(BLOCK_DOOR, (complexMaterial, settings) -> { addBlockEntry(new BlockEntry(BLOCK_PRESSURE_PLATE, (complexMaterial, settings) -> {
return new BaseDoorBlock(getBlock(BLOCK_PLANKS)); return new WoodenPressurePlateBlock(getBlock(BLOCK_PLANKS));
}).setBlockTags(BlockTags.DOORS, BlockTags.WOODEN_DOORS).setItemTags(ItemTags.DOORS, ItemTags.WOODEN_DOORS)); }).setBlockTags(BlockTags.PRESSURE_PLATES, BlockTags.WOODEN_PRESSURE_PLATES)
.setItemTags(ItemTags.WOODEN_PRESSURE_PLATES));
addBlockEntry(new BlockEntry(BLOCK_TRAPDOOR, (complexMaterial, settings) -> {
addBlockEntry(new BlockEntry(BLOCK_LADDER, (complexMaterial, settings) -> { return new BaseTrapdoorBlock(getBlock(BLOCK_PLANKS));
return new BaseLadderBlock(getBlock(BLOCK_PLANKS)); }).setBlockTags(BlockTags.TRAPDOORS, BlockTags.WOODEN_TRAPDOORS)
}).setBlockTags(BlockTags.CLIMBABLE)); .setItemTags(ItemTags.TRAPDOORS, ItemTags.WOODEN_TRAPDOORS));
addBlockEntry(new BlockEntry(BLOCK_SIGN, (complexMaterial, settings) -> { addBlockEntry(new BlockEntry(BLOCK_DOOR, (complexMaterial, settings) -> {
return new BaseSignBlock(getBlock(BLOCK_PLANKS)); return new BaseDoorBlock(getBlock(BLOCK_PLANKS));
}).setBlockTags(BlockTags.SIGNS).setItemTags(ItemTags.SIGNS)); }).setBlockTags(BlockTags.DOORS, BlockTags.WOODEN_DOORS)
.setItemTags(ItemTags.DOORS, ItemTags.WOODEN_DOORS));
}
addBlockEntry(new BlockEntry(BLOCK_LADDER, (complexMaterial, settings) -> {
final protected void initStorage(FabricBlockSettings blockSettings, FabricItemSettings itemSettings){ return new BaseLadderBlock(getBlock(BLOCK_PLANKS));
addBlockEntry(new BlockEntry(BLOCK_CHEST, (complexMaterial, settings) -> { }).setBlockTags(BlockTags.CLIMBABLE));
return new BaseChestBlock(getBlock(BLOCK_PLANKS)); addBlockEntry(new BlockEntry(BLOCK_SIGN, (complexMaterial, settings) -> {
}).setBlockTags(TagAPI.BLOCK_CHEST).setItemTags(TagAPI.ITEM_CHEST)); return new BaseSignBlock(getBlock(BLOCK_PLANKS));
addBlockEntry(new BlockEntry(BLOCK_BARREL, (complexMaterial, settings) -> { }).setBlockTags(BlockTags.SIGNS)
return new BaseBarrelBlock(getBlock(BLOCK_PLANKS)); .setItemTags(ItemTags.SIGNS));
}));
}
}
final protected void initDecorations(FabricBlockSettings blockSettings, FabricItemSettings itemSettings){
addBlockEntry(new BlockEntry(BLOCK_CRAFTING_TABLE, (complexMaterial, settings) -> { final protected void initStorage(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
return new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS)); addBlockEntry(new BlockEntry(BLOCK_CHEST, (complexMaterial, settings) -> {
}).setBlockTags(TagAPI.BLOCK_WORKBENCHES).setItemTags(TagAPI.ITEM_WORKBENCHES)); return new BaseChestBlock(getBlock(BLOCK_PLANKS));
}).setBlockTags(TagAPI.BLOCK_CHEST, TagAPI.BLOCK_WOODEN_CHEST)
addBlockEntry(new BlockEntry(BLOCK_BOOKSHELF, (complexMaterial, settings) -> { .setItemTags(TagAPI.ITEM_CHEST, TagAPI.ITEM_WOODEN_CHEST));
return new BaseBookshelfBlock(getBlock(BLOCK_PLANKS));
}).setBlockTags(TagAPI.BLOCK_BOOKSHELVES)); addBlockEntry(new BlockEntry(BLOCK_BARREL, (complexMaterial, settings) -> {
return new BaseBarrelBlock(getBlock(BLOCK_PLANKS));
addBlockEntry(new BlockEntry(BLOCK_COMPOSTER, (complexMaterial, settings) -> { }).setBlockTags(TagAPI.BLOCK_BARREL, TagAPI.BLOCK_WOODEN_BARREL)
return new BaseComposterBlock(getBlock(BLOCK_PLANKS)); .setItemTags(TagAPI.ITEM_BARREL, TagAPI.ITEM_WOODEN_BARREL));
})); }
}
final protected void initDecorations(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
@Override addBlockEntry(new BlockEntry(BLOCK_CRAFTING_TABLE, (complexMaterial, settings) -> {
protected void initFlammable(FlammableBlockRegistry registry) { return new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS));
getBlocks().forEach(block -> { }).setBlockTags(TagAPI.BLOCK_WORKBENCHES)
registry.add(block, 5, 20); .setItemTags(TagAPI.ITEM_WORKBENCHES));
});
addBlockEntry(new BlockEntry(BLOCK_BOOKSHELF, (complexMaterial, settings) -> {
registry.add(getBlock(BLOCK_LOG), 5, 5); return new BaseBookshelfBlock(getBlock(BLOCK_PLANKS));
registry.add(getBlock(BLOCK_BARK), 5, 5); }).setBlockTags(TagAPI.BLOCK_BOOKSHELVES));
registry.add(getBlock(BLOCK_STRIPPED_LOG), 5, 5);
registry.add(getBlock(BLOCK_STRIPPED_BARK), 5, 5); addBlockEntry(new BlockEntry(BLOCK_COMPOSTER, (complexMaterial, settings) -> {
} return new BaseComposterBlock(getBlock(BLOCK_PLANKS));
}));
@Override }
public void initDefaultRecipes() {
Block planks = getBlock(BLOCK_PLANKS); @Override
addRecipeEntry(new RecipeEntry("planks", (material, config, id) -> { protected void initFlammable(FlammableBlockRegistry registry) {
Block log_stripped = getBlock(BLOCK_STRIPPED_LOG); getBlocks().forEach(block -> {
Block bark_stripped = getBlock(BLOCK_STRIPPED_BARK); registry.add(block, 5, 20);
Block log = getBlock(BLOCK_LOG); });
Block bark = getBlock(BLOCK_BARK);
GridRecipe.make(id, planks) registry.add(getBlock(BLOCK_LOG), 5, 5);
.checkConfig(config) registry.add(getBlock(BLOCK_BARK), 5, 5);
.setOutputCount(4) registry.add(getBlock(BLOCK_STRIPPED_LOG), 5, 5);
.setList("#") registry.add(getBlock(BLOCK_STRIPPED_BARK), 5, 5);
.addMaterial('#', log, bark, log_stripped, bark_stripped) }
.setGroup(receipGroupPrefix +"_planks")
.build(); @Override
})); public void initDefaultRecipes() {
addRecipeEntry(new RecipeEntry("stairs", (material, config, id) -> { Block planks = getBlock(BLOCK_PLANKS);
GridRecipe.make(id, getBlock(BLOCK_STAIRS)) addRecipeEntry(new RecipeEntry("planks", (material, config, id) -> {
.checkConfig(config) Block log_stripped = getBlock(BLOCK_STRIPPED_LOG);
.setOutputCount(4) Block bark_stripped = getBlock(BLOCK_STRIPPED_BARK);
.setShape("# ", "## ", "###") Block log = getBlock(BLOCK_LOG);
.addMaterial('#', planks) Block bark = getBlock(BLOCK_BARK);
.setGroup(receipGroupPrefix +"_planks_stairs") GridRecipe.make(id, planks)
.build(); .checkConfig(config)
})); .setOutputCount(4)
addRecipeEntry(new RecipeEntry("slab", (material, config, id) -> { .setList("#")
GridRecipe.make(id, getBlock(BLOCK_SLAB)) .addMaterial('#', log, bark, log_stripped, bark_stripped)
.checkConfig(config) .setGroup(receipGroupPrefix + "_planks")
.setOutputCount(6) .build();
.setShape("###") }));
.addMaterial('#', planks) addRecipeEntry(new RecipeEntry("stairs", (material, config, id) -> {
.setGroup(receipGroupPrefix +"_planks_slabs") GridRecipe.make(id, getBlock(BLOCK_STAIRS))
.build(); .checkConfig(config)
})); .setOutputCount(4)
addRecipeEntry(new RecipeEntry("fence", (material, config, id) -> { .setShape("# ", "## ", "###")
GridRecipe.make(id, getBlock(BLOCK_FENCE)) .addMaterial('#', planks)
.checkConfig(config) .setGroup(receipGroupPrefix + "_planks_stairs")
.setOutputCount(3) .build();
.setShape("#I#", "#I#") }));
.addMaterial('#', planks) addRecipeEntry(new RecipeEntry("slab", (material, config, id) -> {
.addMaterial('I', Items.STICK) GridRecipe.make(id, getBlock(BLOCK_SLAB))
.setGroup(receipGroupPrefix +"_planks_fences") .checkConfig(config)
.build(); .setOutputCount(6)
})); .setShape("###")
addRecipeEntry(new RecipeEntry("gate", (material, config, id) -> { .addMaterial('#', planks)
GridRecipe.make(id, getBlock(BLOCK_GATE)) .setGroup(receipGroupPrefix + "_planks_slabs")
.checkConfig(config) .build();
.setShape("I#I", "I#I") }));
.addMaterial('#', planks) addRecipeEntry(new RecipeEntry("fence", (material, config, id) -> {
.addMaterial('I', Items.STICK) GridRecipe.make(id, getBlock(BLOCK_FENCE))
.setGroup(receipGroupPrefix +"_planks_gates") .checkConfig(config)
.build(); .setOutputCount(3)
})); .setShape("#I#", "#I#")
addRecipeEntry(new RecipeEntry("button", (material, config, id) -> { .addMaterial('#', planks)
GridRecipe.make(id, getBlock(BLOCK_BUTTON)) .addMaterial('I', Items.STICK)
.checkConfig(config) .setGroup(receipGroupPrefix + "_planks_fences")
.setList("#") .build();
.addMaterial('#', planks) }));
.setGroup(receipGroupPrefix +"_planks_buttons") addRecipeEntry(new RecipeEntry("gate", (material, config, id) -> {
.build(); GridRecipe.make(id, getBlock(BLOCK_GATE))
})); .checkConfig(config)
addRecipeEntry(new RecipeEntry("pressure_plate", (material, config, id) -> { .setShape("I#I", "I#I")
GridRecipe.make(id, getBlock(BLOCK_PRESSURE_PLATE)) .addMaterial('#', planks)
.checkConfig(config) .addMaterial('I', Items.STICK)
.setShape("##") .setGroup(receipGroupPrefix + "_planks_gates")
.addMaterial('#', planks) .build();
.setGroup(receipGroupPrefix +"_planks_plates") }));
.build(); addRecipeEntry(new RecipeEntry("button", (material, config, id) -> {
})); GridRecipe.make(id, getBlock(BLOCK_BUTTON))
addRecipeEntry(new RecipeEntry("trapdoor", (material, config, id) -> { .checkConfig(config)
GridRecipe.make(id, getBlock(BLOCK_TRAPDOOR)) .setList("#")
.checkConfig(config) .addMaterial('#', planks)
.setOutputCount(2) .setGroup(receipGroupPrefix + "_planks_buttons")
.setShape("###", "###") .build();
.addMaterial('#', planks) }));
.setGroup(receipGroupPrefix +"_trapdoors") addRecipeEntry(new RecipeEntry("pressure_plate", (material, config, id) -> {
.build(); GridRecipe.make(id, getBlock(BLOCK_PRESSURE_PLATE))
})); .checkConfig(config)
addRecipeEntry(new RecipeEntry("door", (material, config, id) -> { .setShape("##")
GridRecipe.make(id, getBlock(BLOCK_DOOR)) .addMaterial('#', planks)
.checkConfig(config) .setGroup(receipGroupPrefix + "_planks_plates")
.setOutputCount(3) .build();
.setShape("##", "##", "##") }));
.addMaterial('#', planks) addRecipeEntry(new RecipeEntry("trapdoor", (material, config, id) -> {
.setGroup(receipGroupPrefix +"_doors") GridRecipe.make(id, getBlock(BLOCK_TRAPDOOR))
.build(); .checkConfig(config)
})); .setOutputCount(2)
addRecipeEntry(new RecipeEntry("crafting_table", (material, config, id) -> { .setShape("###", "###")
GridRecipe.make(id, getBlock(BLOCK_CRAFTING_TABLE)) .addMaterial('#', planks)
.checkConfig(config) .setGroup(receipGroupPrefix + "_trapdoors")
.setShape("##", "##") .build();
.addMaterial('#', planks) }));
.setGroup(receipGroupPrefix +"_tables") addRecipeEntry(new RecipeEntry("door", (material, config, id) -> {
.build(); GridRecipe.make(id, getBlock(BLOCK_DOOR))
})); .checkConfig(config)
addRecipeEntry(new RecipeEntry("ladder", (material, config, id) -> { .setOutputCount(3)
GridRecipe.make(id, getBlock(BLOCK_LADDER)) .setShape("##", "##", "##")
.checkConfig(config) .addMaterial('#', planks)
.setOutputCount(3) .setGroup(receipGroupPrefix + "_doors")
.setShape("I I", "I#I", "I I") .build();
.addMaterial('#', planks) }));
.addMaterial('I', Items.STICK) addRecipeEntry(new RecipeEntry("crafting_table", (material, config, id) -> {
.setGroup(receipGroupPrefix +"_ladders") GridRecipe.make(id, getBlock(BLOCK_CRAFTING_TABLE))
.build(); .checkConfig(config)
})); .setShape("##", "##")
addRecipeEntry(new RecipeEntry("sign", (material, config, id) -> { .addMaterial('#', planks)
GridRecipe.make(id, getBlock(BLOCK_SIGN)) .setGroup(receipGroupPrefix + "_tables")
.checkConfig(config) .build();
.setOutputCount(3) }));
.setShape("###", "###", " I ") addRecipeEntry(new RecipeEntry("ladder", (material, config, id) -> {
.addMaterial('#', planks) GridRecipe.make(id, getBlock(BLOCK_LADDER))
.addMaterial('I', Items.STICK) .checkConfig(config)
.setGroup(receipGroupPrefix +"_signs") .setOutputCount(3)
.build(); .setShape("I I", "I#I", "I I")
})); .addMaterial('#', planks)
addRecipeEntry(new RecipeEntry("chest", (material, config, id) -> { .addMaterial('I', Items.STICK)
GridRecipe.make(id, getBlock(BLOCK_CHEST)) .setGroup(receipGroupPrefix + "_ladders")
.checkConfig(config) .build();
.setShape("###", "# #", "###") }));
.addMaterial('#', planks) addRecipeEntry(new RecipeEntry("sign", (material, config, id) -> {
.setGroup(receipGroupPrefix +"_chests") GridRecipe.make(id, getBlock(BLOCK_SIGN))
.build(); .checkConfig(config)
})); .setOutputCount(3)
addRecipeEntry(new RecipeEntry("barrel", (material, config, id) -> { .setShape("###", "###", " I ")
GridRecipe.make(id, getBlock(BLOCK_BARREL)) .addMaterial('#', planks)
.checkConfig(config) .addMaterial('I', Items.STICK)
.setShape("#S#", "# #", "#S#") .setGroup(receipGroupPrefix + "_signs")
.addMaterial('#', planks) .build();
.addMaterial('S', getBlock(BLOCK_SLAB)) }));
.setGroup(receipGroupPrefix +"_barrels") addRecipeEntry(new RecipeEntry("chest", (material, config, id) -> {
.build(); GridRecipe.make(id, getBlock(BLOCK_CHEST))
})); .checkConfig(config)
addRecipeEntry(new RecipeEntry("bookshelf", (material, config, id) -> { .setShape("###", "# #", "###")
GridRecipe.make(id, getBlock(BLOCK_BOOKSHELF)) .addMaterial('#', planks)
.checkConfig(config) .setGroup(receipGroupPrefix + "_chests")
.setShape("###", "PPP", "###") .build();
.addMaterial('#', planks) }));
.addMaterial('P', Items.BOOK) addRecipeEntry(new RecipeEntry("barrel", (material, config, id) -> {
.setGroup(receipGroupPrefix +"_bookshelves") GridRecipe.make(id, getBlock(BLOCK_BARREL))
.build(); .checkConfig(config)
})); .setShape("#S#", "# #", "#S#")
addRecipeEntry(new RecipeEntry("bark", (material, config, id) -> { .addMaterial('#', planks)
GridRecipe.make(id, getBlock(BLOCK_BARK)) .addMaterial('S', getBlock(BLOCK_SLAB))
.checkConfig(config) .setGroup(receipGroupPrefix + "_barrels")
.setShape("##", "##") .build();
.addMaterial('#', getBlock(BLOCK_LOG)) }));
.setOutputCount(3) addRecipeEntry(new RecipeEntry("bookshelf", (material, config, id) -> {
.build(); GridRecipe.make(id, getBlock(BLOCK_BOOKSHELF))
})); .checkConfig(config)
addRecipeEntry(new RecipeEntry("log", (material, config, id) -> { .setShape("###", "PPP", "###")
GridRecipe.make(id, getBlock(BLOCK_LOG)) .addMaterial('#', planks)
.checkConfig(config) .addMaterial('P', Items.BOOK)
.setShape("##", "##") .setGroup(receipGroupPrefix + "_bookshelves")
.addMaterial('#', getBlock(BLOCK_BARK)) .build();
.setOutputCount(3) }));
.build(); addRecipeEntry(new RecipeEntry("bark", (material, config, id) -> {
})); GridRecipe.make(id, getBlock(BLOCK_BARK))
addRecipeEntry(new RecipeEntry("stripped_bark", (material, config, id) -> { .checkConfig(config)
GridRecipe.make(id, getBlock(BLOCK_STRIPPED_BARK)) .setShape("##", "##")
.checkConfig(config) .addMaterial('#', getBlock(BLOCK_LOG))
.setShape("##", "##") .setOutputCount(3)
.addMaterial('#', getBlock(BLOCK_STRIPPED_LOG)) .build();
.setOutputCount(3) }));
.build(); addRecipeEntry(new RecipeEntry("log", (material, config, id) -> {
})); GridRecipe.make(id, getBlock(BLOCK_LOG))
addRecipeEntry(new RecipeEntry("stripped_log", (material, config, id) -> { .checkConfig(config)
GridRecipe.make(id, getBlock(BLOCK_STRIPPED_LOG)) .setShape("##", "##")
.checkConfig(config) .addMaterial('#', getBlock(BLOCK_BARK))
.setShape("##", "##") .setOutputCount(3)
.addMaterial('#', getBlock(BLOCK_STRIPPED_BARK)) .build();
.setOutputCount(3) }));
.build(); addRecipeEntry(new RecipeEntry("stripped_bark", (material, config, id) -> {
})); GridRecipe.make(id, getBlock(BLOCK_STRIPPED_BARK))
addRecipeEntry(new RecipeEntry("composter", (material, config, id) -> { .checkConfig(config)
GridRecipe.make(id, getBlock(BLOCK_COMPOSTER)) .setShape("##", "##")
.checkConfig(config) .addMaterial('#', getBlock(BLOCK_STRIPPED_LOG))
.setShape("# #", "# #", "###") .setOutputCount(3)
.addMaterial('#', getBlock(BLOCK_SLAB)) .build();
.build(); }));
})); addRecipeEntry(new RecipeEntry("stripped_log", (material, config, id) -> {
addRecipeEntry(new RecipeEntry("shulker", (material, config, id) -> { GridRecipe.make(id, getBlock(BLOCK_STRIPPED_LOG))
GridRecipe.make(id, Blocks.SHULKER_BOX) .checkConfig(config)
.checkConfig(config) .setShape("##", "##")
.setShape("S", "#", "S") .addMaterial('#', getBlock(BLOCK_STRIPPED_BARK))
.addMaterial('S', Items.SHULKER_SHELL) .setOutputCount(3)
.addMaterial('#', getBlock(BLOCK_CHEST)) .build();
.build(); }));
})); addRecipeEntry(new RecipeEntry("composter", (material, config, id) -> {
} GridRecipe.make(id, getBlock(BLOCK_COMPOSTER))
.checkConfig(config)
.setShape("# #", "# #", "###")
.addMaterial('#', getBlock(BLOCK_SLAB))
.build();
}));
addRecipeEntry(new RecipeEntry("shulker", (material, config, id) -> {
GridRecipe.make(id, Blocks.SHULKER_BOX)
.checkConfig(config)
.setShape("S", "#", "S")
.addMaterial('S', Items.SHULKER_SHELL)
.addMaterial('#', getBlock(BLOCK_CHEST))
.build();
}));
}
} }