net.minecraft.client.renderer.color.IBlockColor Java Examples

The following examples show how to use net.minecraft.client.renderer.color.IBlockColor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientProxy.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public void init() {

	//Colorizers
	CrystalColorizer colorizer = new CrystalColorizer();
	Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler((IBlockColor)colorizer, new Block[] {AdvancedRocketryBlocks.blockCrystal});
	Minecraft.getMinecraft().getItemColors().registerItemColorHandler((IItemColor)colorizer,  Item.getItemFromBlock(AdvancedRocketryBlocks.blockCrystal));

	Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new IItemColor()
       {
           public int getColorFromItemstack(ItemStack stack, int tintIndex)
           {
               return tintIndex > 0 ? -1 : ((ItemArmor)stack.getItem()).getColor(stack);
           }
       }, AdvancedRocketryItems.itemSpaceSuit_Boots, AdvancedRocketryItems.itemSpaceSuit_Chest, AdvancedRocketryItems.itemSpaceSuit_Helmet, AdvancedRocketryItems.itemSpaceSuit_Leggings);
	
	AdvancedRocketry.materialRegistry.init();
}
 
Example #2
Source File: ClientProxy.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public void init(FMLInitializationEvent event) {
    super.init(event);

    Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new IBlockColor() {
        @Override
        public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
            int metadata = state.getValue(BlockBarrel.FERM);
            return metadata >= 7 ? 0x885511 : ((BlockBarrel) state.getBlock()).isUnderWeight((World) worldIn, pos) ? 0xffd399 : 0xffffff;
        }
    }, BlockLoader.MISOBARREL);
}
 
Example #3
Source File: Foliage.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void registerExtendedBlockColor(BlockColors bc, IExtendedBlockColor extColor, Block... blocks) {
	Map<IRegistryDelegate<Block>, IBlockColor> internalMap = ObfuscationReflectionHelper.getPrivateValue(BlockColors.class, bc, "blockColorMap"); //forge-added field in 1.12, no srg name available
	//TODO someone test this in obf lol
	
	for(Block b : blocks) {
		IRegistryDelegate<Block> delegate = b.delegate;
		IBlockColor regularColor = internalMap.get(delegate);
		
		bc.registerBlockColorHandler(((state, world, pos, tintIndex) -> extColor.colorMultiplierExt(regularColor, state, world, pos, tintIndex)), b);
	}
}
 
Example #4
Source File: Foliage.java    From CommunityMod with GNU Lesser General Public License v2.1 votes vote down vote up
int colorMultiplierExt(IBlockColor sup, IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tint);