Fix ItemSeedFood respecting custom soils.

This commit is contained in:
LexManos 2013-03-05 15:44:31 -08:00
parent 43a1bf1425
commit c2b610d335

View file

@ -1,10 +1,13 @@
--- ../src_base/minecraft/net/minecraft/item/ItemSeedFood.java
+++ ../src_work/minecraft/net/minecraft/item/ItemSeedFood.java
@@ -2,8 +2,10 @@
@@ -1,9 +1,13 @@
package net.minecraft.item;
+import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
-public class ItemSeedFood extends ItemFood
@ -12,7 +15,18 @@
{
/** Block ID of the crop this seed food should place. */
private int cropId;
@@ -48,4 +50,22 @@
@@ -31,8 +35,9 @@
else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack))
{
int i1 = par3World.getBlockId(par4, par5, par6);
+ Block soil = Block.blocksList[i1];
- if (i1 == this.soilId && par3World.isAirBlock(par4, par5 + 1, par6))
+ if (soil != null && soil.canSustainPlant(par3World, par4, par5, par6, ForgeDirection.UP, this) && par3World.isAirBlock(par4, par5 + 1, par6))
{
par3World.func_94575_c(par4, par5 + 1, par6, this.cropId);
--par1ItemStack.stackSize;
@@ -48,4 +53,22 @@
return false;
}
}