diff --git a/src/dark/api/events/MachineMiningEvent.java b/src/dark/api/events/MachineMiningEvent.java index 68e80ba1..a77a289d 100644 --- a/src/dark/api/events/MachineMiningEvent.java +++ b/src/dark/api/events/MachineMiningEvent.java @@ -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 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 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 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; } } diff --git a/src/dark/core/helpers/InvInteractionHelper.java b/src/dark/core/helpers/InvInteractionHelper.java index f3e4d3a8..45dd3243 100644 --- a/src/dark/core/helpers/InvInteractionHelper.java +++ b/src/dark/core/helpers/InvInteractionHelper.java @@ -166,7 +166,7 @@ public class InvInteractionHelper } } - if (itemStack.stackSize <= 0) + if (itemStack == null || itemStack.stackSize <= 0) { return null; }