Im trying to check if an item is in my inv and make the item get removed and make the block spawn an item
this is my current code:
public class CoffeeMachine extends Block {
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
dropItemStack(new ItemStack(ItemManager.Coffee, 5), par1World, par2, par3, par4);
return true;
}
public static void dropItemStack(ItemStack item, World world, int x, int y, int z)
{
if(!world.isRemote)
{
EntityItem entityitem = new EntityItem(world, x, y, z, item);
entityitem.posX = x;
entityitem.posY = y;
entityitem.posZ = z;
world.spawnEntityInWorld(entityitem);
}
}
does anyone know of a method that i can use to check if an item is in my inv and when this code runs it removes the item?
this is my current code:
public class CoffeeMachine extends Block {
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
dropItemStack(new ItemStack(ItemManager.Coffee, 5), par1World, par2, par3, par4);
return true;
}
public static void dropItemStack(ItemStack item, World world, int x, int y, int z)
{
if(!world.isRemote)
{
EntityItem entityitem = new EntityItem(world, x, y, z, item);
entityitem.posX = x;
entityitem.posY = y;
entityitem.posZ = z;
world.spawnEntityInWorld(entityitem);
}
}
does anyone know of a method that i can use to check if an item is in my inv and when this code runs it removes the item?
Oh ok i was trying to do it client side Thx