From f270231e679e0bfa057f37500e60821a2cd9d9c1 Mon Sep 17 00:00:00 2001 From: Nedelosk Date: Sat, 17 Feb 2018 14:25:11 +0100 Subject: [PATCH] Fix "X-Ray" Leaves and wrong leaf particle color --- lang | 2 +- .../arboriculture/blocks/BlockAbstractLeaves.java | 4 ++-- .../arboriculture/blocks/BlockDecorativeLeaves.java | 13 +++++++------ .../arboriculture/blocks/BlockDefaultLeaves.java | 7 ++++--- .../arboriculture/blocks/BlockForestryLeaves.java | 6 +++--- .../items/ItemBlockDecorativeLeaves.java | 5 ++--- .../arboriculture/items/ItemBlockLeaves.java | 6 +++--- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lang b/lang index c560d5270..70c994e53 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit c560d52707b3976bbe51c4ba7c3d26fdb947ce75 +Subproject commit 70c994e535e82f8a1d55f80a74ff6020675ffde5 diff --git a/src/main/java/forestry/arboriculture/blocks/BlockAbstractLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockAbstractLeaves.java index 36f37ed9b..a8e204bb9 100755 --- a/src/main/java/forestry/arboriculture/blocks/BlockAbstractLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockAbstractLeaves.java @@ -43,8 +43,8 @@ import forestry.core.utils.BlockUtil; * Parent class for shared behavior between {@link BlockDefaultLeaves} and {@link BlockForestryLeaves} */ public abstract class BlockAbstractLeaves extends BlockLeaves implements IItemModelRegister, IColoredBlock { - public static final int FOLIAGE_COLOR_INDEX = 1; - public static final int FRUIT_COLOR_INDEX = 0; + public static final int FOLIAGE_COLOR_INDEX = 0; + public static final int FRUIT_COLOR_INDEX = 2; @Nullable protected abstract ITree getTree(IBlockAccess world, BlockPos pos); diff --git a/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java index 38fe0e371..64058a11b 100755 --- a/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java @@ -32,6 +32,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import forestry.api.arboriculture.IFruitProvider; +import forestry.api.arboriculture.ILeafSpriteProvider; import forestry.api.arboriculture.ITreeGenome; import forestry.api.core.IItemModelRegister; import forestry.api.core.IModelManager; @@ -109,10 +110,10 @@ public abstract class BlockDecorativeLeaves extends Block implements IItemModelR @Override public boolean isOpaqueCube(IBlockState state) { if(!Proxies.render.fancyGraphicsEnabled()){ - return true; + TreeDefinition treeDefinition = state.getValue(getVariant()); + return !TreeDefinition.Willow.equals(treeDefinition); } - TreeDefinition treeDefinition = state.getValue(getVariant()); - return !TreeDefinition.Willow.equals(treeDefinition); + return false; } @Override @@ -214,11 +215,11 @@ public abstract class BlockDecorativeLeaves extends Block implements IItemModelR TreeDefinition treeDefinition = state.getValue(getVariant()); ITreeGenome genome = treeDefinition.getGenome(); - if (tintIndex == BlockAbstractLeaves.FOLIAGE_COLOR_INDEX) { - return genome.getPrimary().getLeafSpriteProvider().getColor(false); - } else { + if (tintIndex == BlockAbstractLeaves.FRUIT_COLOR_INDEX) { IFruitProvider fruitProvider = genome.getFruitProvider(); return fruitProvider.getDecorativeColor(); } + ILeafSpriteProvider spriteProvider = genome.getPrimary().getLeafSpriteProvider(); + return spriteProvider.getColor(false); } } diff --git a/src/main/java/forestry/arboriculture/blocks/BlockDefaultLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockDefaultLeaves.java index 59f34e0f4..0aff07bcb 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockDefaultLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockDefaultLeaves.java @@ -26,6 +26,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import forestry.api.arboriculture.EnumGermlingType; import forestry.api.arboriculture.IFruitProvider; +import forestry.api.arboriculture.ILeafSpriteProvider; import forestry.api.arboriculture.ITree; import forestry.api.arboriculture.ITreeGenome; import forestry.api.arboriculture.TreeManager; @@ -194,11 +195,11 @@ public abstract class BlockDefaultLeaves extends BlockAbstractLeaves { } ITreeGenome genome = treeDefinition.getGenome(); - if (tintIndex == BlockAbstractLeaves.FOLIAGE_COLOR_INDEX) { - return genome.getPrimary().getLeafSpriteProvider().getColor(false); - } else { + if (tintIndex == BlockAbstractLeaves.FRUIT_COLOR_INDEX) { IFruitProvider fruitProvider = genome.getFruitProvider(); return fruitProvider.getDecorativeColor(); } + ILeafSpriteProvider spriteProvider = genome.getPrimary().getLeafSpriteProvider(); + return spriteProvider.getColor(false); } } diff --git a/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java index 4e317d3da..ebf11c6a3 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java @@ -207,11 +207,11 @@ public class BlockForestryLeaves extends BlockAbstractLeaves implements ITileEnt if (worldIn != null && pos != null) { TileLeaves leaves = TileUtil.getTile(worldIn, pos, TileLeaves.class); if (leaves != null) { - if (tintIndex == BlockAbstractLeaves.FOLIAGE_COLOR_INDEX) { + if (tintIndex == BlockAbstractLeaves.FRUIT_COLOR_INDEX) { + return leaves.getFruitColour(); + }else { EntityPlayer thePlayer = Minecraft.getMinecraft().player; return leaves.getFoliageColour(thePlayer); - } else { - return leaves.getFruitColour(); } } } diff --git a/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java b/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java index efcc77385..6689522c9 100755 --- a/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java +++ b/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java @@ -36,11 +36,10 @@ public class ItemBlockDecorativeLeaves extends ItemBlockForestry impl TileLeaves tileLeaves = new TileLeaves(); tileLeaves.readFromNBT(itemStack.getTagCompound()); - if (renderPass == BlockAbstractLeaves.FOLIAGE_COLOR_INDEX) { + if (renderPass == BlockAbstractLeaves.FRUIT_COLOR_INDEX) { + return tileLeaves.getFruitColour(); + }else { EntityPlayer player = Minecraft.getMinecraft().player; return tileLeaves.getFoliageColour(player); - } else { - return tileLeaves.getFruitColour(); } }