diff --git a/src/main/java/forestry/arboriculture/blocks/BlockAbstractLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockAbstractLeaves.java index 5fd9c1781..36f37ed9b 100755 --- a/src/main/java/forestry/arboriculture/blocks/BlockAbstractLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockAbstractLeaves.java @@ -43,6 +43,9 @@ 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; + @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 1d5a67830..38fe0e371 100755 --- a/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java @@ -109,10 +109,10 @@ public abstract class BlockDecorativeLeaves extends Block implements IItemModelR @Override public boolean isOpaqueCube(IBlockState state) { if(!Proxies.render.fancyGraphicsEnabled()){ - TreeDefinition treeDefinition = state.getValue(getVariant()); - return !TreeDefinition.Willow.equals(treeDefinition); + return true; } - return false; + TreeDefinition treeDefinition = state.getValue(getVariant()); + return !TreeDefinition.Willow.equals(treeDefinition); } @Override @@ -214,7 +214,7 @@ public abstract class BlockDecorativeLeaves extends Block implements IItemModelR TreeDefinition treeDefinition = state.getValue(getVariant()); ITreeGenome genome = treeDefinition.getGenome(); - if (tintIndex == 0) { + if (tintIndex == BlockAbstractLeaves.FOLIAGE_COLOR_INDEX) { return genome.getPrimary().getLeafSpriteProvider().getColor(false); } else { IFruitProvider fruitProvider = genome.getFruitProvider(); diff --git a/src/main/java/forestry/arboriculture/blocks/BlockDefaultLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockDefaultLeaves.java index 3e50b45f4..59f34e0f4 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockDefaultLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockDefaultLeaves.java @@ -194,7 +194,7 @@ public abstract class BlockDefaultLeaves extends BlockAbstractLeaves { } ITreeGenome genome = treeDefinition.getGenome(); - if (tintIndex == 0) { + if (tintIndex == BlockAbstractLeaves.FOLIAGE_COLOR_INDEX) { return genome.getPrimary().getLeafSpriteProvider().getColor(false); } else { IFruitProvider fruitProvider = genome.getFruitProvider(); diff --git a/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java index fe91b9627..4e317d3da 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java @@ -207,7 +207,7 @@ 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 == 0) { + if (tintIndex == BlockAbstractLeaves.FOLIAGE_COLOR_INDEX) { EntityPlayer thePlayer = Minecraft.getMinecraft().player; return leaves.getFoliageColour(thePlayer); } else { diff --git a/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java b/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java index 3bcaa5b6c..efcc77385 100755 --- a/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java +++ b/src/main/java/forestry/arboriculture/items/ItemBlockDecorativeLeaves.java @@ -1,14 +1,17 @@ package forestry.arboriculture.items; +import net.minecraft.item.ItemStack; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.arboriculture.IFruitProvider; import forestry.api.arboriculture.ITreeGenome; +import forestry.arboriculture.blocks.BlockAbstractLeaves; import forestry.arboriculture.blocks.BlockDecorativeLeaves; import forestry.arboriculture.genetics.TreeDefinition; import forestry.core.items.IColoredItem; import forestry.core.items.ItemBlockForestry; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; public class ItemBlockDecorativeLeaves extends ItemBlockForestry implements IColoredItem { public ItemBlockDecorativeLeaves(BlockDecorativeLeaves block) { @@ -33,7 +36,7 @@ public class ItemBlockDecorativeLeaves extends ItemBlockForestry impl TileLeaves tileLeaves = new TileLeaves(); tileLeaves.readFromNBT(itemStack.getTagCompound()); - if (renderPass == 0) { + if (renderPass == BlockAbstractLeaves.FOLIAGE_COLOR_INDEX) { EntityPlayer player = Minecraft.getMinecraft().player; return tileLeaves.getFoliageColour(player); } else { diff --git a/src/main/java/forestry/arboriculture/models/ModelDecorativeLeaves.java b/src/main/java/forestry/arboriculture/models/ModelDecorativeLeaves.java index dd77e4951..b784a8af7 100644 --- a/src/main/java/forestry/arboriculture/models/ModelDecorativeLeaves.java +++ b/src/main/java/forestry/arboriculture/models/ModelDecorativeLeaves.java @@ -11,15 +11,7 @@ package forestry.arboriculture.models; import com.google.common.base.Preconditions; -import forestry.api.arboriculture.IAlleleTreeSpecies; -import forestry.api.arboriculture.ILeafSpriteProvider; -import forestry.api.arboriculture.ITreeGenome; -import forestry.api.core.IModelBaker; -import forestry.arboriculture.blocks.BlockDecorativeLeaves; -import forestry.arboriculture.genetics.TreeDefinition; -import forestry.core.models.ModelBlockCached; -import forestry.core.models.baker.ModelBaker; -import forestry.core.proxy.Proxies; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -28,9 +20,21 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import forestry.api.arboriculture.IAlleleTreeSpecies; +import forestry.api.arboriculture.ILeafSpriteProvider; +import forestry.api.arboriculture.ITreeGenome; +import forestry.api.core.IModelBaker; +import forestry.arboriculture.blocks.BlockAbstractLeaves; +import forestry.arboriculture.blocks.BlockDecorativeLeaves; +import forestry.arboriculture.genetics.TreeDefinition; +import forestry.core.models.ModelBlockCached; +import forestry.core.models.baker.ModelBaker; +import forestry.core.proxy.Proxies; + @SideOnly(Side.CLIENT) public class ModelDecorativeLeaves extends ModelBlockCached { public ModelDecorativeLeaves() { @@ -65,13 +69,13 @@ public class ModelDecorativeLeaves extends ModelBlockCached { public ModelDefaultLeaves() { @@ -67,13 +71,13 @@ public class ModelDefaultLeaves extends ModelBlockCached { @@ -125,10 +129,10 @@ public class ModelLeaves extends ModelBlockCached