diff --git a/api/forestry b/api/forestry index 0aab3badc..619a6451e 160000 --- a/api/forestry +++ b/api/forestry @@ -1 +1 @@ -Subproject commit 0aab3badcc3d8c4648fcf245c25fc557fa53f0f7 +Subproject commit 619a6451e75d629592259df0975683fe8fe6a083 diff --git a/src/main/java/forestry/arboriculture/genetics/Tree.java b/src/main/java/forestry/arboriculture/genetics/Tree.java index 116fcfc4f..43f874817 100755 --- a/src/main/java/forestry/arboriculture/genetics/Tree.java +++ b/src/main/java/forestry/arboriculture/genetics/Tree.java @@ -49,11 +49,9 @@ import forestry.api.genetics.IEffectData; import forestry.api.genetics.IFruitFamily; import forestry.api.genetics.IMutation; import forestry.arboriculture.genetics.alleles.AlleleFruit; -import forestry.arboriculture.tiles.TileLeaves; import forestry.core.config.Config; import forestry.core.genetics.Chromosome; import forestry.core.genetics.Individual; -import forestry.core.tiles.TileUtil; import forestry.core.utils.StringUtil; public class Tree extends Individual implements ITree, IPlantable { @@ -223,21 +221,29 @@ public class Tree extends Individual implements ITree, IPlantable { @Override public void setLeaves(World world, GameProfile owner, int x, int y, int z) { - genome.getPrimary().getGenerator().setLeaves(world, owner, x, y, z, false); - TileLeaves leaves = TileUtil.getTile(world, x, y, z, TileLeaves.class); - if (leaves != null) { - leaves.setTree(this); + try { + genome.getPrimary().getGenerator().setLeaves(genome, world, owner, x, y, z, false); + } catch (Throwable ignored) { + genome.getPrimary().getGenerator().setLeaves(world, owner, x, y, z, false); } } @Override public void setLeavesDecorative(World world, GameProfile owner, int x, int y, int z) { - genome.getPrimary().getGenerator().setLeaves(world, owner, x, y, z, true); + try { + genome.getPrimary().getGenerator().setLeaves(genome, world, owner, x, y, z, true); + } catch (Throwable ignored) { + genome.getPrimary().getGenerator().setLeaves(world, owner, x, y, z, true); + } } @Override public void setLogBlock(World world, int x, int y, int z, ForgeDirection facing) { - genome.getPrimary().getGenerator().setLogBlock(world, x, y, z, facing); + try { + genome.getPrimary().getGenerator().setLogBlock(genome, world, x, y, z, facing); + } catch (Throwable ignored) { + genome.getPrimary().getGenerator().setLogBlock(world, x, y, z, facing); + } } @Override diff --git a/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java b/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java index 62d5114e3..078cd91e8 100644 --- a/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java @@ -994,7 +994,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator { protected abstract void registerMutations(); @Override - public void setLogBlock(World world, int x, int y, int z, ForgeDirection facing) { + public void setLogBlock(ITreeGenome genome, World world, int x, int y, int z, ForgeDirection facing) { if (woodType == null) { Block vanillaWoodBlock = Block.getBlockFromItem(vanillaWood.getItem()); int vanillaWoodMeta = vanillaWood.getItemDamage(); @@ -1022,7 +1022,12 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator { } @Override - public void setLeaves(World world, GameProfile owner, int x, int y, int z, boolean decorative) { + public void setLogBlock(World world, int x, int y, int z, ForgeDirection facing) { + setLogBlock(genome, world, x, y, z, facing); + } + + @Override + public void setLeaves(ITreeGenome genome, World world, GameProfile owner, int x, int y, int z, boolean decorative) { boolean placed = world.setBlock(x, y, z, PluginArboriculture.blocks.leaves, 0, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); if (!placed) { return; @@ -1044,11 +1049,16 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator { if (decorative) { tileLeaves.setDecorative(); } - tileLeaves.setTree(getIndividual()); + tileLeaves.setTree(new Tree(genome)); world.markBlockForUpdate(x, y, z); } + @Override + public void setLeaves(World world, GameProfile owner, int x, int y, int z, boolean decorative) { + setLeaves(genome, world, owner, x, y, z, decorative); + } + public static void initTrees() { for (TreeDefinition tree : values()) { tree.init();