From c66d3dd748682cc871461d76666635a76787f307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 4 Jul 2016 14:51:37 +0200 Subject: [PATCH] Registry - handle coloured blocks --- src/java/mmm/utils/I_UColoredBlock.java | 7 +++++++ src/java/mmm/utils/URegistry.java | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 src/java/mmm/utils/I_UColoredBlock.java diff --git a/src/java/mmm/utils/I_UColoredBlock.java b/src/java/mmm/utils/I_UColoredBlock.java new file mode 100644 index 0000000..75c7e7f --- /dev/null +++ b/src/java/mmm/utils/I_UColoredBlock.java @@ -0,0 +1,7 @@ +package mmm.utils; + + +public interface I_UColoredBlock +{ + // EMPTY +} diff --git a/src/java/mmm/utils/URegistry.java b/src/java/mmm/utils/URegistry.java index a031646..61b47f1 100644 --- a/src/java/mmm/utils/URegistry.java +++ b/src/java/mmm/utils/URegistry.java @@ -12,6 +12,7 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemCloth; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; @@ -117,8 +118,14 @@ public class URegistry public static void addBlock( final Block block , final boolean registerItemModel ) { - URegistry.addBlock( block , new ItemBlock( block ).setRegistryName( block.getRegistryName( ) ) , - registerItemModel ); + Item item; + if ( block instanceof I_UColoredBlock ) { + item = new ItemCloth( block ); + } else { + item = new ItemBlock( block ); + } + item.setRegistryName( block.getRegistryName( ) ); + URegistry.addBlock( block , item , registerItemModel ); }