Prevent the digital miner from stalling when the block break is denied. Skip it instead
@@ -253,7 +253,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
}
}
- if(inverse == hasFilter)
+ if(inverse == hasFilter || !canMine(coord))
{
set.clear(index);
@@ -367,15 +367,6 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
* returns false if unsuccessful
*/
public boolean setReplace(Coord4D obj, int index)
- {
- IBlockState state = obj.getBlockState(world);
- Block block = state.getBlock();
-
- EntityPlayer dummy = Mekanism.proxy.getDummyPlayer((WorldServer)world, obj.x, obj.y, obj.z).get();
- BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, obj.getPos(), state, dummy);
- MinecraftForge.EVENT_BUS.post(event);
-
- if(!event.isCanceled())
{
ItemStack stack = getReplace(index);
@@ -408,7 +399,14 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
}
}
- return false;
+ private boolean canMine(Coord4D coord){
+ IBlockState state = coord.getBlockState(world);
+
+ EntityPlayer dummy = Mekanism.proxy.getDummyPlayer((WorldServer)world, coord.x, coord.y, coord.z).get();
+ BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, coord.getPos(), state, dummy);
+ MinecraftForge.EVENT_BUS.post(event);
+
+ return !event.isCanceled();
}
public ItemStack getReplace(int index)
