Registry - handle coloured blocks

This commit is contained in:
Emmanuel BENOîT 2016-07-04 14:51:37 +02:00
parent 47b663ae14
commit c66d3dd748
2 changed files with 16 additions and 2 deletions

View file

@ -0,0 +1,7 @@
package mmm.utils;
public interface I_UColoredBlock
{
// EMPTY
}

View file

@ -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 );
}