Revert block changes

This commit is contained in:
raoulvdberge
2017-03-04 20:31:09 +01:00
parent 55f6a72cb0
commit 2143db8b9d
2 changed files with 6 additions and 38 deletions

View File

@@ -23,7 +23,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
@@ -113,24 +112,7 @@ public abstract class BlockBase extends Block {
} }
@Override @Override
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) { public void breakBlock(World world, BlockPos pos, IBlockState state) {
super.onBlockDestroyedByPlayer(world, pos, state);
if (!world.isRemote) {
dropContents(world, pos);
}
}
@Override
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion) {
super.onBlockDestroyedByExplosion(world, pos, explosion);
if (!world.isRemote) {
dropContents(world, pos);
}
}
private 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) {
@@ -142,6 +124,8 @@ public abstract class BlockBase extends Block {
} }
} }
} }
super.breakBlock(world, pos, state);
} }
@Override @Override

View File

@@ -13,7 +13,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -50,24 +49,7 @@ public abstract class BlockNode extends BlockBase {
} }
@Override @Override
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) { public void breakBlock(World world, BlockPos pos, IBlockState state) {
super.onBlockDestroyedByPlayer(world, pos, state);
if (!world.isRemote) {
removeNode(world, pos);
}
}
@Override
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion) {
super.onBlockDestroyedByExplosion(world, pos, explosion);
if (!world.isRemote) {
removeNode(world, pos);
}
}
private void removeNode(World world, BlockPos pos) {
INetworkNodeManager manager = API.instance().getNetworkNodeManager(world.provider.getDimension()); INetworkNodeManager manager = API.instance().getNetworkNodeManager(world.provider.getDimension());
INetworkNode node = manager.getNode(pos); INetworkNode node = manager.getNode(pos);
@@ -79,6 +61,8 @@ public abstract class BlockNode extends BlockBase {
if (node.getNetwork() != null) { if (node.getNetwork() != null) {
node.getNetwork().getNodeGraph().rebuild(); node.getNetwork().getNodeGraph().rebuild();
} }
super.breakBlock(world, pos, state);
} }
@Override @Override