use of net.minecraft.client.renderer.color.ItemColors in project ForestryMC by ForestryMC.
the class ModelManager method registerItemAndBlockColors.
@SideOnly(Side.CLIENT)
public void registerItemAndBlockColors() {
Minecraft minecraft = Minecraft.getMinecraft();
BlockColors blockColors = minecraft.getBlockColors();
for (IColoredBlock blockColor : blockColorList) {
if (blockColor instanceof Block) {
blockColors.registerBlockColorHandler(ColoredBlockBlockColor.INSTANCE, (Block) blockColor);
}
}
ItemColors itemColors = minecraft.getItemColors();
for (IColoredItem itemColor : itemColorList) {
if (itemColor instanceof Item) {
itemColors.registerItemColorHandler(ColoredItemItemColor.INSTANCE, (Item) itemColor);
}
}
}
use of net.minecraft.client.renderer.color.ItemColors in project Geolosys by oitsjustjose.
the class BlockColorInit method registerItemColors.
@SubscribeEvent
public static void registerItemColors(ColorHandlerEvent.Item evt) {
final BlockColors blockColors = evt.getBlockColors();
final ItemColors itemColors = evt.getItemColors();
// Use the Block's colour handler for an ItemBlock
IItemColor itemBlockColourHandler = (stack, tintIndex) -> {
BlockState state = ((BlockItem) stack.getItem()).getBlock().getDefaultState();
return blockColors.getColor(state, null, null, tintIndex);
};
if (itemBlockColourHandler != null) {
itemColors.register(itemBlockColourHandler, ModBlocks.getInstance().peat);
itemColors.register(itemBlockColourHandler, ModBlocks.getInstance().rhododendron);
}
}
use of net.minecraft.client.renderer.color.ItemColors in project NetherEx by LogicTechCorp.
the class NetherEx method onRegisterItemColor.
@OnlyIn(Dist.CLIENT)
private void onRegisterItemColor(ColorHandlerEvent.Item event) {
ItemColors colors = event.getItemColors();
NetherExItems.getItems().forEach(registryObject -> {
registryObject.ifPresent(item -> {
if (item instanceof ModSpawnEggItem) {
colors.register((color, index) -> ((ModSpawnEggItem) item).getColor(index), item);
}
});
});
}
Aggregations