From 6d00d35ae51a962a57a353e2a47e363ae5b330a3 Mon Sep 17 00:00:00 2001 From: mezz Date: Fri, 6 May 2016 17:27:51 -0700 Subject: [PATCH] Fix decorative leaf colors --- .../blocks/BlockDecorativeLeaves.java | 15 ++++++++++----- .../items/ItemBlockDecorativeLeaves.java | 6 ++---- src/main/java/forestry/core/utils/ColourUtil.java | 6 ------ 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java index c5af17e6b..79a330fa6 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java @@ -31,6 +31,8 @@ import net.minecraftforge.common.IShearable; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import forestry.api.arboriculture.IFruitProvider; +import forestry.api.arboriculture.ITreeGenome; import forestry.api.core.IItemModelRegister; import forestry.api.core.IModelManager; import forestry.api.core.Tabs; @@ -202,17 +204,20 @@ public abstract class BlockDecorativeLeaves extends Block implements IShearable, } @Override + @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) { - TileLeaves leaves = TileUtil.getTile(worldIn, pos, TileLeaves.class); - if (leaves == null) { + TreeDefinition treeDefinition = state.getValue(getVariant()); + if (treeDefinition == null) { return PluginArboriculture.proxy.getFoliageColorBasic(); } + ITreeGenome genome = treeDefinition.getGenome(); + if (tintIndex == 0) { - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - return leaves.getFoliageColour(thePlayer); + return genome.getPrimary().getLeafSpriteProvider().getColor(false); } else { - return leaves.getFruitColour(); + IFruitProvider fruitProvider = genome.getFruitProvider(); + return fruitProvider.getDecorativeColor(); } } } diff --git a/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java b/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java index 28d258ae9..9ca05fbdf 100644 --- a/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java +++ b/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java @@ -43,12 +43,10 @@ public class ItemBlockDecorativeLeaves extends ItemBlockForestry> 16 & 0xFF; - int b = rgb & 0xFF; - return rgb & 0xFF00FF00 | r | b << 16; - } - public static int addRGBComponents(int colour, int r, int g, int b) { r = ((colour & 0xff0000) >> 16) + r; g = ((colour & 0xff00) >> 8) + g;