Topic category: Help with Minecraft modding (Java Edition)
I found this while digging through Biome.java
@SideOnly(Side.CLIENT)
public int getGrassColorAtPos(BlockPos pos)
{
double d0 = (double)MathHelper.clamp(this.getTemperature(pos), 0.0F, 1.0F);
double d1 = (double)MathHelper.clamp(this.getRainfall(), 0.0F, 1.0F);
return getModdedBiomeGrassColor(ColorizerGrass.getGrassColor(d0, d1));
}
So that's I think the biome changes the grass block's color.
also saw this in grass block, not sure if it's helpful
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT_MIPPED;
}
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state)
----------------------------------------------------
If anyone has any coding experience and actually knows how to implement biome color-dependent blocks please speak up :D
It's something my mod heavily needs :)
I am looking for a proper way to do this too :D
Some info about the extra code:
public BlockRenderLayer getBlockLayer() describes how the block is rendered (they're the transparency settings you can chose when creating a custom block: solid, cutout, cutout-mipped, translucent)
public int getMetaFromState(IBlockState state) is used by blocks with block states and isn't related to grass color: grass uses block states to pick between "tall grass", "fern" and the unused "shrub"