fixed a bug with inv helper

This commit is contained in:
Robert 2013-11-11 17:45:54 -05:00
parent 7f5b317cf9
commit 6d397bcf98
2 changed files with 16 additions and 16 deletions

View file

@ -55,28 +55,28 @@ public class MachineMiningEvent extends Event
public static boolean doMachineMiningCheck(World world, Vector3 target, TileEntity machine)
{
int blockID = target.getBlockID(world);
Block block = Block.blocksList[blockID];
if (block != null && !block.isAirBlock(world, target.intX(), target.intY(), target.intZ()) && block.getBlockHardness(world, target.intX(), target.intY(), target.intZ()) >= 0)
{
return true;
}
return false;
Block block = Block.blocksList[target.getBlockID(world)];
return block != null && target.getTileEntity(world) == null && !block.isAirBlock(world, target.intX(), target.intY(), target.intZ()) && block.getBlockHardness(world, target.intX(), target.intY(), target.intZ()) >= 0;
}
public static List<ItemStack> getItemsMined(World world, Vector3 target, TileEntity machine)
{
int blockID = target.getBlockID(world);
int meta = target.getBlockMetadata(world);
Block block = Block.blocksList[blockID];
Block block = Block.blocksList[target.getBlockID(world)];
if (block != null)
{
List<ItemStack> items = block.getBlockDropped(world, target.intX(), target.intY(), target.intZ(), meta, 1);
MiningDrop event = new MiningDrop(world, target, machine, items);
MinecraftForge.EVENT_BUS.post(event);
items = event.items;
return items;
List<ItemStack> items = block.getBlockDropped(world, target.intX(), target.intY(), target.intZ(), target.getBlockMetadata(world), 1);
if (items != null)
{
System.out.println("Items");
MiningDrop event = new MiningDrop(world, target, machine, items);
MinecraftForge.EVENT_BUS.post(event);
items = event.items;
return items;
}
}
System.out.println("no Items");
return null;
}
}

View file

@ -166,7 +166,7 @@ public class InvInteractionHelper
}
}
if (itemStack.stackSize <= 0)
if (itemStack == null || itemStack.stackSize <= 0)
{
return null;
}