Compare commits

...

2 Commits

Author SHA1 Message Date
Justin Parsell 575ea6ed40 Modified some debug data 2021-03-29 23:53:46 -04:00
Justin Parsell 3a1a707eff introduction of new registry handler 2021-03-29 22:02:24 -04:00
5 changed files with 178 additions and 100 deletions

View File

@ -4,8 +4,10 @@ import net.fabricmc.api.ModInitializer;
import net.parsell.cherry.core.CherryBlocks;
import net.parsell.cherry.core.CherryFeatures;
import net.parsell.cherry.core.CherryItems;
import net.parsell.cherry.core.CherryRegistry;
public class Cherry implements ModInitializer {
public static final String MODID = "cherry";
@Override
public void onInitialize() {
@ -14,8 +16,13 @@ public class Cherry implements ModInitializer {
// Proceed with mild caution.
System.out.println("Cherry Initilizating...");
CherryRegistry.init();
CherryBlocks.init();
CherryItems.init();
CherryFeatures.init();
CherryRegistry.finish();
System.out.println("Cherry setup successfully!");
}
}

View File

@ -1,11 +1,6 @@
package net.parsell.cherry.core;
import com.google.common.collect.ImmutableMap.Builder;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@ -18,146 +13,128 @@ import net.minecraft.block.SignBlock;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.entity.SignBlockEntity;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Identifier;
import net.minecraft.util.SignType;
import net.minecraft.util.registry.Registry;
import net.parsell.cherry.common.blocks.CherryButtonBlock;
import net.parsell.cherry.common.blocks.CherryDoorBlock;
import net.parsell.cherry.common.blocks.CherryPressurePlate;
import net.parsell.cherry.common.blocks.CherryStairsBlock;
import net.parsell.cherry.common.blocks.CherryTrapdoorBlock;
import net.parsell.cherry.mixin.AxeItemAccessor;
public class CherryBlocks {
private static Builder<Block, Block> STRIPPABLE_BLOCKS = new Builder<Block, Block>();
public static final Block CHERRYLOGSTRIPPED = registerPillar("stripped_cherry_log", FabricBlockSettings.copyOf(Blocks.STRIPPED_OAK_LOG), 5, 5);
public static final Block CHERRYLOG = registerPillar("cherry_log", FabricBlockSettings.copyOf(Blocks.OAK_LOG), 5, 5, CHERRYLOGSTRIPPED);
public static final Block CHERRYWOOD = registerPillar("cherry_wood", FabricBlockSettings.copyOf(Blocks.OAK_WOOD), 5, 5);
public static final Block CHERRYWOODSTRIPPED = registerPillar("stripped_cherry_wood", FabricBlockSettings.copyOf(Blocks.STRIPPED_OAK_WOOD), 5, 5);
public static final Block CHERRYLEAVES = registerLeaves("cherry_leaves", FabricBlockSettings.copyOf(Blocks.OAK_LEAVES), 30, 60, 6649929);
public static final Block CHERRYPLANKS = registerBlock("cherry_planks", FabricBlockSettings.copyOf(Blocks.OAK_PLANKS), 5, 20);
public static final Block CHERRYFENCE = registerFence("cherry_fence", FabricBlockSettings.copyOf(Blocks.OAK_FENCE), 5, 20); // TODO: tags (as required)
public static final Block CHERRYFENCEGATE = registerFenceGate("cherry_fence_gate", FabricBlockSettings.copyOf(Blocks.OAK_FENCE_GATE), 5, 20); // TODO: recipe, loot_tables, tags (as required)
public static final Block CHERRYDOOR = registerDoor("cherry_door", FabricBlockSettings.copyOf(Blocks.OAK_DOOR), 5, 20); // TODO: recipe, loot_tables, tags (as required)
public static final Block CHERRYTRAPDOOR = registerTrapDoor("cherry_trapdoor", FabricBlockSettings.copyOf(Blocks.OAK_TRAPDOOR), 5, 20); //TODO: recipe, loot_tables, tags (as required)
public static final Block CHERRYSLAB = registerSlab("cherry_slab", FabricBlockSettings.copyOf(Blocks.OAK_SLAB), 5, 20); // TODO: recipe, loot tables, tags (as required)
public static final Block CHERRYSTAIRS = registerStair("cherry_stairs", CHERRYPLANKS.getDefaultState(), FabricBlockSettings.copyOf(Blocks.OAK_STAIRS), 5, 20); //TODO: recipe, loot tables, tags (as required)
public static final Block CHERRYBUTTON = registerButton("cherry_button", FabricBlockSettings.copyOf(Blocks.OAK_BUTTON), 5, 20); //TODO: recipe, loot tables, tags (as required)
public static final Block CHERRYPRESSUREPLATE = registerPressurePlate("cherry_pressure_plate", PressurePlateBlock.ActivationRule.EVERYTHING, FabricBlockSettings.copyOf(Blocks.OAK_PRESSURE_PLATE), 5, 20); //TODO: recipe, loot tables, tags (as required)
public static final Block CHERRYSIGN = registerSign("cherry_sign", SignType.OAK, FabricBlockSettings.copyOf(Blocks.OAK_SIGN), 5, 20); // TODO: recipe, loot tables
public static final Block CHERRYLOGSTRIPPED = createPillar("stripped_cherry_log", FabricBlockSettings.copyOf(Blocks.STRIPPED_OAK_LOG), 5, 5);
public static final Block CHERRYLOG = createPillar("cherry_log", FabricBlockSettings.copyOf(Blocks.OAK_LOG), 5, 5, CHERRYLOGSTRIPPED);
public static final Block CHERRYWOOD = createPillar("cherry_wood", FabricBlockSettings.copyOf(Blocks.OAK_WOOD), 5, 5);
public static final Block CHERRYWOODSTRIPPED = createPillar("stripped_cherry_wood", FabricBlockSettings.copyOf(Blocks.STRIPPED_OAK_WOOD), 5, 5);
public static final Block CHERRYLEAVES = createLeaves("cherry_leaves", FabricBlockSettings.copyOf(Blocks.OAK_LEAVES), 30, 60, 6649929);
public static final Block CHERRYPLANKS = createBlock("cherry_planks", FabricBlockSettings.copyOf(Blocks.OAK_PLANKS), 5, 20);
public static final Block CHERRYFENCE = createFence("cherry_fence", FabricBlockSettings.copyOf(Blocks.OAK_FENCE), 5, 20); // TODO: tags (as required)
public static final Block CHERRYFENCEGATE = createFenceGate("cherry_fence_gate", FabricBlockSettings.copyOf(Blocks.OAK_FENCE_GATE), 5, 20); // TODO: recipe, loot_tables, tags (as required)
public static final Block CHERRYDOOR = createDoor("cherry_door", FabricBlockSettings.copyOf(Blocks.OAK_DOOR), 5, 20); // TODO: recipe, loot_tables, tags (as required)
public static final Block CHERRYTRAPDOOR = createTrapDoor("cherry_trapdoor", FabricBlockSettings.copyOf(Blocks.OAK_TRAPDOOR), 5, 20); //TODO: recipe, loot_tables, tags (as required)
public static final Block CHERRYSLAB = createSlab("cherry_slab", FabricBlockSettings.copyOf(Blocks.OAK_SLAB), 5, 20); // TODO: recipe, loot tables, tags (as required)
public static final Block CHERRYSTAIRS = createStair("cherry_stairs", CHERRYPLANKS.getDefaultState(), FabricBlockSettings.copyOf(Blocks.OAK_STAIRS), 5, 20); //TODO: recipe, loot tables, tags (as required)
public static final Block CHERRYBUTTON = createButton("cherry_button", FabricBlockSettings.copyOf(Blocks.OAK_BUTTON), 5, 20); //TODO: recipe, loot tables, tags (as required)
public static final Block CHERRYPRESSUREPLATE = createPressurePlate("cherry_pressure_plate", PressurePlateBlock.ActivationRule.EVERYTHING, FabricBlockSettings.copyOf(Blocks.OAK_PRESSURE_PLATE), 5, 20); //TODO: recipe, loot tables, tags (as required)
public static final SignType CHERRYSIGN_TYPE = CherryRegistry.register("cherry");
public static final Block CHERRYSIGN = createSign("cherry_sign", CHERRYSIGN_TYPE, FabricBlockSettings.copyOf(Blocks.OAK_SIGN), 5, 20); // TODO: recipe, loot tables
public static final BlockEntityType<SignBlockEntity> CHERRYSIGN_ENTITY = BlockEntityType.Builder.create(SignBlockEntity::new, CHERRYSIGN).build(null);
private static Block registerBlock(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
private static Block createBlock(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
Block block = new Block(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
return block;
}
private static Block registerSlab(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
private static Block createSlab(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
Block block = new SlabBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
return block;
}
private static Block registerStair(String blockID, BlockState baseBlockState, FabricBlockSettings settings, int burnChance, int burnSpread) {
private static Block createStair(String blockID, BlockState baseBlockState, FabricBlockSettings settings, int burnChance, int burnSpread) {
Block block = new CherryStairsBlock(baseBlockState, settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
return block;
}
private static Block registerButton(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
private static Block createButton(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
Block block = new CherryButtonBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
return block;
}
private static Block registerPressurePlate(String blockID, PressurePlateBlock.ActivationRule rule, FabricBlockSettings settings, int burnChance, int burnSpread) {
private static Block createPressurePlate(String blockID, PressurePlateBlock.ActivationRule rule, FabricBlockSettings settings, int burnChance, int burnSpread) {
Block block = new CherryPressurePlate(rule, settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
return block;
}
private static Block registerSign(String blockID, SignType type, FabricBlockSettings settings, int burnChance, int burnSpread) {
private static Block createSign(String blockID, SignType type, FabricBlockSettings settings, int burnChance, int burnSpread) {
Block block = new SignBlock(settings, type);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
return block;
}
private static Block registerFence(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
private static Block createFence(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
Block block = new FenceBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
return block;
}
private static Block registerFenceGate(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
private static Block createFenceGate(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
Block block = new FenceGateBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
return block;
}
private static Block registerPillar(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
private static Block createPillar(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
Block block = new PillarBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
return block;
}
private static Block registerPillar(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread, Block strippedVariant){
private static Block createPillar(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread, Block strippedVariant){
Block block = new PillarBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
STRIPPABLE_BLOCKS.put(block, strippedVariant);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
CherryRegistry.addStrippable(block, strippedVariant);
return block;
}
private static Block registerLeaves(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread, int color){
private static Block createLeaves(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread, int color){
Block block = new LeavesBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> {
return color;
}, block);
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
CherryRegistry.registerColor(block, color);
return block;
}
private static Block registerDoor(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
private static Block createDoor(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
Block block = new CherryDoorBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout());
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
CherryRegistry.registerTransparentLayer(block);
return block;
}
private static Block registerTrapDoor(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
private static Block createTrapDoor(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
Block block = new CherryTrapdoorBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout());
CherryRegistry.register(block, blockID);
CherryRegistry.registerBurnable(block, burnChance, burnSpread);
CherryRegistry.registerTransparentLayer(block);
return block;
}
public static void init(){
// Ensure not to overwrite on previous strippable logs
AxeItemAccessor.getStrippedLogs().forEach((log, strippedLog) -> {
STRIPPABLE_BLOCKS.put(log, strippedLog);
});
// Register unique logs
AxeItemAccessor.setStrippedLogs(STRIPPABLE_BLOCKS.build());
System.out.println(CHERRYSIGN_ENTITY.toString());
if(!(CHERRYSIGN_ENTITY == null))
Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier("cherry", "cherry_sign"), CHERRYSIGN_ENTITY);
else
System.out.println("cherry:cherry_sign entity is null");
CherryRegistry.register(CHERRYSIGN_ENTITY, "cherry_sign");
}
}

View File

@ -44,6 +44,8 @@ public class CherryFeatures {
}
public static void init(){
System.out.println("Cherry Features inititalizating...");
addFeatures();
System.out.println("Cherry Features setup sucessfully!");
}
}

View File

@ -10,27 +10,30 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class CherryItems {
public static final BlockItem CherryPlanks;
private static void registerBlockItems(){
registerBlockItem("cherry_log", CherryBlocks.CHERRYLOG, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_wood", CherryBlocks.CHERRYWOOD, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("stripped_cherry_log", CherryBlocks.CHERRYLOGSTRIPPED, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("stripped_cherry_wood", CherryBlocks.CHERRYWOODSTRIPPED, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_leaves", CherryBlocks.CHERRYLEAVES, ItemGroup.BUILDING_BLOCKS, 6649929);
registerBlockItem("cherry_planks", CherryBlocks.CHERRYPLANKS, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_fence", CherryBlocks.CHERRYFENCE, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_fence_gate", CherryBlocks.CHERRYFENCEGATE, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_door", CherryBlocks.CHERRYDOOR, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_trapdoor", CherryBlocks.CHERRYTRAPDOOR, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_slab", CherryBlocks.CHERRYSLAB, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_stairs", CherryBlocks.CHERRYSTAIRS, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_button", CherryBlocks.CHERRYBUTTON, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_pressure_plate", CherryBlocks.CHERRYPRESSUREPLATE, ItemGroup.BUILDING_BLOCKS);
registerSignItem("cherry_sign", CherryBlocks.CHERRYSIGN, CherryBlocks.CHERRYSIGN, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_log", CherryBlocks.CHERRYLOG, CherryRegistry.CHERRY_GROUP);
registerBlockItem("cherry_wood", CherryBlocks.CHERRYWOOD, CherryRegistry.CHERRY_GROUP);
registerBlockItem("stripped_cherry_log", CherryBlocks.CHERRYLOGSTRIPPED, CherryRegistry.CHERRY_GROUP);
registerBlockItem("stripped_cherry_wood", CherryBlocks.CHERRYWOODSTRIPPED, CherryRegistry.CHERRY_GROUP);
registerBlockItem("cherry_leaves", CherryBlocks.CHERRYLEAVES, CherryRegistry.CHERRY_GROUP, 6649929);
registerBlockItem("cherry_fence", CherryBlocks.CHERRYFENCE, CherryRegistry.CHERRY_GROUP);
registerBlockItem("cherry_fence_gate", CherryBlocks.CHERRYFENCEGATE, CherryRegistry.CHERRY_GROUP);
registerBlockItem("cherry_door", CherryBlocks.CHERRYDOOR, CherryRegistry.CHERRY_GROUP);
registerBlockItem("cherry_trapdoor", CherryBlocks.CHERRYTRAPDOOR, CherryRegistry.CHERRY_GROUP);
registerBlockItem("cherry_slab", CherryBlocks.CHERRYSLAB, CherryRegistry.CHERRY_GROUP);
registerBlockItem("cherry_stairs", CherryBlocks.CHERRYSTAIRS, CherryRegistry.CHERRY_GROUP);
registerBlockItem("cherry_button", CherryBlocks.CHERRYBUTTON, CherryRegistry.CHERRY_GROUP);
registerBlockItem("cherry_pressure_plate", CherryBlocks.CHERRYPRESSUREPLATE, CherryRegistry.CHERRY_GROUP);
registerSignItem("cherry_sign", CherryBlocks.CHERRYSIGN, CherryBlocks.CHERRYSIGN, CherryRegistry.CHERRY_GROUP);
}
// Register a standard blockItem
private static void registerBlockItem(String itemID, Block block, ItemGroup group){
Registry.register(Registry.ITEM, new Identifier("cherry", itemID), new BlockItem(block, new FabricItemSettings().group(group)));
private static BlockItem registerBlockItem(String itemID, Block block, ItemGroup group){
BlockItem blockItem = new BlockItem(block, new FabricItemSettings().group(group));
Registry.register(Registry.ITEM, new Identifier("cherry", itemID), blockItem);
return blockItem;
}
// Register a blockItem that require in-game color (leaves)
@ -48,6 +51,12 @@ public class CherryItems {
}
public static void init(){
System.out.println("Cherry Items initilizating...");
registerBlockItems();
System.out.println("Cherry Items setup correctly!");
}
static{
CherryPlanks = registerBlockItem("cherry_planks", CherryBlocks.CHERRYPLANKS, CherryRegistry.CHERRY_GROUP);
}
}

View File

@ -0,0 +1,83 @@
package net.parsell.cherry.core;
import net.parsell.cherry.Cherry;
import net.parsell.cherry.common.util.CherrySignType;
import net.parsell.cherry.mixin.*;
import com.google.common.collect.ImmutableMap.Builder;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.SignType;
import net.minecraft.util.registry.Registry;
public class CherryRegistry {
private static Builder<Block, Block> STRIPPABLE_BLOCKS = new Builder<Block, Block>();
public static final ItemGroup CHERRY_GROUP = FabricItemGroupBuilder
.create(new Identifier(Cherry.MODID, "general"))
.icon(() -> new ItemStack(CherryItems.CherryPlanks))
.build();
public static void init(){
AxeItemAccessor.getStrippedLogs().forEach((log, strippedLog) -> {
STRIPPABLE_BLOCKS.put(log, strippedLog);
});
System.out.println("Cherry Registry initilizating...");
}
public static void finish(){
AxeItemAccessor.setStrippedLogs(STRIPPABLE_BLOCKS.build());
System.out.println("Cherry Registry setup correctly!");
}
public static void register(Block block, String id){
Registry.register(Registry.BLOCK, new Identifier(Cherry.MODID, id), block);
}
public static void register(BlockItem item, String id){
Registry.register(Registry.ITEM, new Identifier(Cherry.MODID, id), item);
}
public static void register(BlockEntityType<?> blockEntityType, String id){
Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(Cherry.MODID, id), blockEntityType);
}
// This registry is unique since I need to save the SignType, and the only way to do that is to register it. So..
public static SignType register(String type){
try {
return SignTypeInvoker.register(new CherrySignType(type));
} catch (IllegalAccessException iae){
System.out.println("CherryRegistry threw IllegalAccessException when trying to register \"" + type + "\" sign type.");
iae.printStackTrace();
}
return null;
}
public static void registerBurnable(Block block, int burnChance, int burnSpread){
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
}
public static void registerColor(Block block, int color){
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> {
return color;
}, block);
}
public static void registerTransparentLayer(Block block){
BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout());
}
public static void addStrippable(Block block, Block stripped){
STRIPPABLE_BLOCKS.put(block, stripped);
}
}