use of biomesoplenty.common.item.IColoredItem in project BiomesOPlenty by Glitchfiend.
the class ClientProxy method registerColouring.
@Override
public void registerColouring() {
// do this here purely for timing reasons
ModelLoader.registerItemVariants(ForgeModContainer.getInstance().universalBucket, bucketModelLocations);
for (Block block : blocksToColour) {
IBOPBlock bopBlock = (IBOPBlock) block;
if (bopBlock.getBlockColor() != null)
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(bopBlock.getBlockColor(), block);
if (bopBlock.getItemColor() != null)
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(bopBlock.getItemColor(), block);
}
for (Item item : itemsToColor) {
IColoredItem coloredItem = (IColoredItem) item;
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(coloredItem.getItemColor(), item);
}
}
use of biomesoplenty.common.item.IColoredItem in project BiomesOPlenty by Glitchfiend.
the class ClientProxy method registerItemSided.
@Override
public void registerItemSided(Item item) {
// register sub types if there are any
if (item.getHasSubtypes()) {
NonNullList<ItemStack> subItems = NonNullList.create();
item.getSubItems(CreativeTabBOP.instance, subItems);
for (ItemStack subItem : subItems) {
String subItemName = item.getUnlocalizedName(subItem);
// remove 'item.' from the front
subItemName = subItemName.substring(subItemName.indexOf(".") + 1);
ModelLoader.registerItemVariants(item, new ResourceLocation(BiomesOPlenty.MOD_ID, subItemName));
ModelLoader.setCustomModelResourceLocation(item, subItem.getMetadata(), new ModelResourceLocation(BiomesOPlenty.MOD_ID + ":" + subItemName, "inventory"));
}
} else {
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(BiomesOPlenty.MOD_ID + ":" + item.delegate.name().getResourcePath(), "inventory"));
}
// Register colour handlers
if (item instanceof IColoredItem && ((IColoredItem) item).getItemColor() != null) {
itemsToColor.add(item);
}
}
Aggregations