Also allow pollen to work on vanilla leaves.
This commit is contained in:
Nirek-K committed 2015-04-15 13:51:00 -05:00
1 parent 240bdd3ad1
commit ca050a7732
2 files changed
+16 -6

No files matched your search

@@ -16,7 +16,6 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@@ -32,6 +31,7 @@ import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import forestry.api.recipes.IVariableFermentable;
import forestry.arboriculture.genetics.ICheckPollinatable;
import forestry.arboriculture.genetics.Tree;
import forestry.arboriculture.genetics.TreeGenome;
import forestry.core.config.Config;
@@ -39,6 +39,7 @@ import forestry.core.genetics.ItemGE;
import forestry.core.network.PacketFXSignal;
import forestry.core.proxy.Proxies;
import forestry.core.render.SpriteSheet;
import forestry.core.utils.GeneticsUtil;
import forestry.core.utils.StringUtil;
import forestry.core.utils.Utils;
import forestry.plugins.PluginArboriculture;
@@ -181,12 +182,18 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
}
} else if (type == EnumGermlingType.POLLEN) {
TileEntity target = world.getTileEntity(x, y, z);
if (!(target instanceof IPollinatable)) {
ICheckPollinatable checkPollinatable = GeneticsUtil.getCheckPollinatable(world, x, y, z);
if (checkPollinatable == null) {
return false;
}
IPollinatable pollinatable = (IPollinatable) target;
if (!checkPollinatable.canMateWith(tree)) {
return false;
}
IPollinatable pollinatable = GeneticsUtil.getOrCreatePollinatable(player.getGameProfile(), world, x, y, z);
if (!pollinatable.canMateWith(tree)) {
return false;
}
@@ -139,9 +139,12 @@ public class GeneticsUtil {
// Treat them as decorative and don't pollinate.
return null;
}
meta %= 3;
if(block == Blocks.leaves2) {
meta = meta + 4; //Dark Oak and Acacia are their own leaf block, but added on the end of sapling
}
block = Blocks.sapling;
}
ItemStack itemStack = new ItemStack(block, meta);
ItemStack itemStack = new ItemStack(block, 1, meta);
IIndividual tree = getGeneticEquivalent(itemStack);
if (tree instanceof ITree) {
return (ITree) tree;