package net.minecraft.item;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
public class ItemSeedFood extends ItemFood implements IPlantable
{
private Block field_150908_b;
/** Block ID of the soil this seed food should be planted on. */
private Block soilId;
private static final String __OBFID = "CL_00000060";
public ItemSeedFood(int p_i45351_1_, float p_i45351_2_, Block p_i45351_3_, Block p_i45351_4_)
{
super(p_i45351_1_, p_i45351_2_, false);
this.field_150908_b = p_i45351_3_;
this.soilId = p_i45351_4_;
}
/**
* Description : Callback for item usage. If the item does something special on right clicking, he will have one of
* those. Return True if something happen and false if it don't. This is for ITEMS, not BLOCKS. Args : stack,
* player, world, x, y, z, side, hitX, hitY, hitZ
*/
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
{
if (p_77648_7_ != 1)
{
return false;
}
else if (p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_ + 1, p_77648_6_, p_77648_7_, p_77648_1_))
{
if (p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_).canSustainPlant(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, ForgeDirection.UP, this) && p_77648_3_.isAirBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_))
{
p_77648_3_.setBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_, this.field_150908_b);
--p_77648_1_.stackSize;
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
@Override
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
{
return EnumPlantType.Crop;
}
@Override
public Block getPlant(IBlockAccess world, int x, int y, int z)
{
return field_150908_b;
}
@Override
public int getPlantMetadata(IBlockAccess world, int x, int y, int z)
{
return 0;
}
}