Fixed inv not dropping on nodes

This commit is contained in:
raoulvdberge
2017-03-11 10:43:33 +01:00
parent 5b28fa7dba
commit bb9c43ad69
2 changed files with 15 additions and 4 deletions

View File

@@ -113,6 +113,17 @@ public abstract class BlockBase extends Block {
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
dropContents(world, pos);
removeTile(world, pos, state);
}
protected void removeTile(World world, BlockPos pos, IBlockState state) {
if (hasTileEntity(state)) {
world.removeTileEntity(pos);
}
}
protected void dropContents(World world, BlockPos pos) {
TileEntity tile = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos);
if (tile instanceof TileBase && ((TileBase) tile).getDrops() != null) {
@@ -124,8 +135,6 @@ public abstract class BlockBase extends Block {
}
}
}
super.breakBlock(world, pos, state);
}
@Override

View File

@@ -54,15 +54,17 @@ public abstract class BlockNode extends BlockBase {
INetworkNode node = manager.getNode(pos);
dropContents(world, pos);
manager.removeNode(pos, true);
API.instance().markNetworkNodesDirty(world);
removeTile(world, pos, state);
if (node.getNetwork() != null) {
node.getNetwork().getNodeGraph().rebuild();
}
super.breakBlock(world, pos, state);
}
@Override