From ed69411d2efc0ae646472be715bd49aa2a30cbd9 Mon Sep 17 00:00:00 2001 From: mezz Date: Tue, 22 Aug 2017 21:45:55 -0700 Subject: [PATCH] Fix #1815 Stop MultiFarm from converting vanilla saplings --- .../arboriculture/genetics/TreeRoot.java | 1 - .../forestry/farming/logic/FarmableGE.java | 10 ++-------- .../farming/logic/FarmableSapling.java | 6 ------ .../farming/logic/FarmableVanillaSapling.java | 19 ------------------- 4 files changed, 2 insertions(+), 34 deletions(-) diff --git a/src/main/java/forestry/arboriculture/genetics/TreeRoot.java b/src/main/java/forestry/arboriculture/genetics/TreeRoot.java index 7d907ec7e..e484b6c78 100644 --- a/src/main/java/forestry/arboriculture/genetics/TreeRoot.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeRoot.java @@ -154,7 +154,6 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot { @Override @Nullable public ITree getMember(ItemStack itemstack) { - itemstack = GeneticsUtil.convertToGeneticEquivalent(itemstack); if (!isMember(itemstack) || itemstack.getTagCompound() == null) { return null; } diff --git a/src/main/java/forestry/farming/logic/FarmableGE.java b/src/main/java/forestry/farming/logic/FarmableGE.java index a744dad56..cf2b4924e 100755 --- a/src/main/java/forestry/farming/logic/FarmableGE.java +++ b/src/main/java/forestry/farming/logic/FarmableGE.java @@ -53,18 +53,12 @@ public class FarmableGE implements IFarmable { public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { ITreeRoot treeRoot = TreeManager.treeRoot; - germling = GeneticsUtil.convertToGeneticEquivalent(germling); - if (treeRoot.isMember(germling)) { - ITree tree = treeRoot.getMember(germling); - return treeRoot.plantSapling(world, tree, player.getGameProfile(), pos); - } else { - return false; - } + ITree tree = treeRoot.getMember(germling); + return tree != null && treeRoot.plantSapling(world, tree, player.getGameProfile(), pos); } @Override public boolean isGermling(ItemStack itemstack) { - itemstack = GeneticsUtil.convertToGeneticEquivalent(itemstack); return TreeManager.treeRoot.isMember(itemstack); } diff --git a/src/main/java/forestry/farming/logic/FarmableSapling.java b/src/main/java/forestry/farming/logic/FarmableSapling.java index 48819d57b..e4a36f0eb 100644 --- a/src/main/java/forestry/farming/logic/FarmableSapling.java +++ b/src/main/java/forestry/farming/logic/FarmableSapling.java @@ -55,12 +55,6 @@ public class FarmableSapling implements IFarmable { @Override public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { - if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.ARBORICULTURE)) { - IIndividual tree = GeneticsUtil.getGeneticEquivalent(germling); - if (tree instanceof ITree) { - return TreeManager.treeRoot.plantSapling(world, (ITree) tree, player.getGameProfile(), pos); - } - } ItemStack copy = germling.copy(); player.setHeldItem(EnumHand.MAIN_HAND, copy); EnumActionResult actionResult = copy.onItemUse(player, world, pos.down(), EnumHand.MAIN_HAND, EnumFacing.UP, 0, 0, 0); diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java b/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java index d72a58306..c22cc397e 100755 --- a/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java +++ b/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java @@ -10,28 +10,9 @@ ******************************************************************************/ package forestry.farming.logic; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import forestry.api.arboriculture.ITree; -import forestry.api.arboriculture.TreeManager; -import forestry.api.core.ForestryAPI; -import forestry.api.farming.ICrop; -import forestry.api.farming.IFarmable; -import forestry.api.genetics.IIndividual; -import forestry.core.network.packets.PacketFXSignal; -import forestry.core.proxy.Proxies; -import forestry.core.utils.GeneticsUtil; -import forestry.plugins.ForestryPluginUids; public class FarmableVanillaSapling extends FarmableSapling {