Fixed inv not dropping on nodes
This commit is contained in:
@@ -113,6 +113,17 @@ public abstract class BlockBase extends Block {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
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);
|
TileEntity tile = IntegrationMCMP.isLoaded() ? RSMCMPAddon.unwrapTile(world, pos) : world.getTileEntity(pos);
|
||||||
|
|
||||||
if (tile instanceof TileBase && ((TileBase) tile).getDrops() != null) {
|
if (tile instanceof TileBase && ((TileBase) tile).getDrops() != null) {
|
||||||
@@ -124,8 +135,6 @@ public abstract class BlockBase extends Block {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock(world, pos, state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -54,15 +54,17 @@ public abstract class BlockNode extends BlockBase {
|
|||||||
|
|
||||||
INetworkNode node = manager.getNode(pos);
|
INetworkNode node = manager.getNode(pos);
|
||||||
|
|
||||||
|
dropContents(world, pos);
|
||||||
|
|
||||||
manager.removeNode(pos, true);
|
manager.removeNode(pos, true);
|
||||||
|
|
||||||
API.instance().markNetworkNodesDirty(world);
|
API.instance().markNetworkNodesDirty(world);
|
||||||
|
|
||||||
|
removeTile(world, pos, state);
|
||||||
|
|
||||||
if (node.getNetwork() != null) {
|
if (node.getNetwork() != null) {
|
||||||
node.getNetwork().getNodeGraph().rebuild();
|
node.getNetwork().getNodeGraph().rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock(world, pos, state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user