Registry - handle coloured blocks
This commit is contained in:
parent
47b663ae14
commit
c66d3dd748
2 changed files with 16 additions and 2 deletions
7
src/java/mmm/utils/I_UColoredBlock.java
Normal file
7
src/java/mmm/utils/I_UColoredBlock.java
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package mmm.utils;
|
||||||
|
|
||||||
|
|
||||||
|
public interface I_UColoredBlock
|
||||||
|
{
|
||||||
|
// EMPTY
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemCloth;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
@ -117,8 +118,14 @@ public class URegistry
|
||||||
|
|
||||||
public static void addBlock( final Block block , final boolean registerItemModel )
|
public static void addBlock( final Block block , final boolean registerItemModel )
|
||||||
{
|
{
|
||||||
URegistry.addBlock( block , new ItemBlock( block ).setRegistryName( block.getRegistryName( ) ) ,
|
Item item;
|
||||||
registerItemModel );
|
if ( block instanceof I_UColoredBlock ) {
|
||||||
|
item = new ItemCloth( block );
|
||||||
|
} else {
|
||||||
|
item = new ItemBlock( block );
|
||||||
|
}
|
||||||
|
item.setRegistryName( block.getRegistryName( ) );
|
||||||
|
URegistry.addBlock( block , item , registerItemModel );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue