From 969c7b39e2412c65fc27c5afb153f196289600d3 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Wed, 16 Jan 2019 11:05:25 +1100 Subject: [PATCH] Fixed inventory grass colouring --- .../java/biomesoplenty/core/ClientProxy.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/biomesoplenty/core/ClientProxy.java b/src/main/java/biomesoplenty/core/ClientProxy.java index 09cb6d7f8..4f80c9547 100644 --- a/src/main/java/biomesoplenty/core/ClientProxy.java +++ b/src/main/java/biomesoplenty/core/ClientProxy.java @@ -11,18 +11,24 @@ import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.item.BOPItems; import biomesoplenty.api.particle.BOPParticleTypes; import biomesoplenty.common.entity.projectile.EntityMudball; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.Particle; +import net.minecraft.client.renderer.color.BlockColors; +import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.client.renderer.entity.RenderSprite; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.Particles; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.particles.ItemParticleData; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.ColorizerGrass; +import net.minecraft.world.IWorldReaderBase; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeColorHelper; import net.minecraftforge.fml.client.registry.RenderingRegistry; @@ -43,9 +49,18 @@ public class ClientProxy extends CommonProxy @Override public void init() { - Minecraft.getInstance().getBlockColors().register((state, world, pos, tintIndex) -> - world != null && pos != null ? BiomeColorHelper.getGrassColor(world, pos) : ColorizerGrass.get(0.5D, 1.0D) - , BOPBlocks.sandy_grass_block, BOPBlocks.loamy_grass_block); + BlockColors blockColors = Minecraft.getInstance().getBlockColors(); + ItemColors itemColors = Minecraft.getInstance().getItemColors(); + + blockColors.register((state, world, pos, tintIndex) -> + world != null && pos != null ? BiomeColorHelper.getGrassColor(world, pos) : ColorizerGrass.get(0.5D, 1.0D) + , BOPBlocks.sandy_grass_block, BOPBlocks.loamy_grass_block); + + itemColors.register((stack, tintIndex) -> + { + IBlockState iblockstate = ((ItemBlock)stack.getItem()).getBlock().getDefaultState(); + return blockColors.getColor(iblockstate, null, null, tintIndex); + }, BOPBlocks.sandy_grass_block, BOPBlocks.loamy_grass_block); } @Override