use of lumien.randomthings.lib.IRTItemColor in project Random-Things by lumien231.
the class ClientProxy method registerColors.
private void registerColors() {
for (Entry<Object, Object> entry : scheduledColorRegister.entrySet()) {
if (entry.getKey() instanceof IRTBlockColor) {
final IRTBlockColor blockColor = (IRTBlockColor) entry.getKey();
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new IBlockColor() {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
return blockColor.colorMultiplier(state, p_186720_2_, pos, tintIndex);
}
}, (Block) entry.getValue());
} else if (entry.getKey() instanceof IRTItemColor) {
final IRTItemColor itemColor = (IRTItemColor) entry.getKey();
try {
ItemColors itemColors = (ItemColors) itemColorsField.get(Minecraft.getMinecraft());
itemColors.registerItemColorHandler(new IItemColor() {
@Override
public int colorMultiplier(ItemStack stack, int tintIndex) {
return itemColor.getColorFromItemstack(stack, tintIndex);
}
}, (Item) entry.getValue());
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
}
Aggregations