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;