Posted July 12, 20169 yr Hello, I have been working on a mod for a bit now and i have tried to create a custom block that chagned color based on biome. I have gotten the overlay to work but i can't find a way to change the color. Here is what i have so far: Block Class: package com.drok.buildersdream.blocks; import com.drok.buildersdream.Ref; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.util.BlockRenderLayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BlockMossyStone extends Block { public BlockMossyStone() { super(Material.ROCK); this.setUnlocalizedName(Ref.ModBlocks.MOSSYSTONE.getUnlocalizedName()); this.setRegistryName(Ref.ModBlocks.MOSSYSTONE.getRegistryName()); } @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT_MIPPED; } } /spoiler If anyone can pointme in the right dirrection that would be great!
July 12, 20169 yr You need to register an IBlockColor and IItemColor for the Block and Item from your client proxy in init. Look at the BlockColors / ItemColors classes to see how vanilla does this. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
July 12, 20169 yr Author I added this to my Init Method but it doesnt seem to work. What am i doing wrong? final BlockColors blockcolors = new BlockColors(); blockcolors.registerBlockColorHandler(new IBlockColor() { public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) { return worldIn != null && pos != null ? BiomeColorHelper.getGrassColorAtPos(worldIn, pos) : ColorizerGrass.getGrassColor(0.5D, 1.0D); } }, new Block[] {ModBlocks.mossyStone});
July 12, 20169 yr Don't create your own instance of BlockColors , it's a singleton. Minecraft will only use its own instance, stored in the Minecraft#blockColors field. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.