Skip to content

Commit

Permalink
Fix crash on explosion, Closes #135
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jun 24, 2020
1 parent 96ce48a commit 087f640
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
10 changes: 7 additions & 3 deletions src/main/java/org/cyclops/colossalchests/block/ChestWall.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.entity.EntityType;
Expand All @@ -25,6 +26,7 @@
import net.minecraft.world.IWorldWriter;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.common.extensions.IForgeBlock;
import org.cyclops.colossalchests.tileentity.TileColossalChest;
import org.cyclops.cyclopscore.block.multi.CubeDetector;
import org.cyclops.cyclopscore.helper.MinecraftHelpers;
Expand Down Expand Up @@ -115,9 +117,11 @@ public void onPlayerDestroy(IWorld world, BlockPos blockPos, BlockState blockSta
}

@Override
public void onExplosionDestroy(World world, BlockPos blockPos, Explosion explosion) {
if(world.getBlockState(blockPos).get(ENABLED)) ColossalChest.triggerDetector(material, world, blockPos, false, null);
super.onExplosionDestroy(world, blockPos, explosion);
public void onBlockExploded(BlockState state, World world, BlockPos pos, Explosion explosion) {
if(world.getBlockState(pos).get(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null);
// IForgeBlock.super.onBlockExploded(state, world, pos, explosion);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 3);
getBlock().onExplosionDestroy(world, pos, explosion);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.entity.EntityType;
Expand Down Expand Up @@ -264,9 +265,11 @@ public void onPlayerDestroy(IWorld world, BlockPos blockPos, BlockState blockSta
}

@Override
public void onExplosionDestroy(World world, BlockPos blockPos, Explosion explosion) {
if(world.getBlockState(blockPos).get(ENABLED)) ColossalChest.triggerDetector(material, world, blockPos, false, null);
super.onExplosionDestroy(world, blockPos, explosion);
public void onBlockExploded(BlockState state, World world, BlockPos pos, Explosion explosion) {
if(world.getBlockState(pos).get(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null);
// IForgeBlock.super.onBlockExploded(state, world, pos, explosion);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 3);
getBlock().onExplosionDestroy(world, pos, explosion);
}

@Override
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/org/cyclops/colossalchests/block/Interface.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.entity.EntityType;
Expand Down Expand Up @@ -118,9 +119,11 @@ public void onPlayerDestroy(IWorld world, BlockPos blockPos, BlockState blockSta
}

@Override
public void onExplosionDestroy(World world, BlockPos blockPos, Explosion explosion) {
if(world.getBlockState(blockPos).get(ENABLED)) ColossalChest.triggerDetector(material, world, blockPos, false, null);
super.onExplosionDestroy(world, blockPos, explosion);
public void onBlockExploded(BlockState state, World world, BlockPos pos, Explosion explosion) {
if(world.getBlockState(pos).get(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null);
// IForgeBlock.super.onBlockExploded(state, world, pos, explosion);
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 3);
getBlock().onExplosionDestroy(world, pos, explosion);
}

@Override
Expand Down

0 comments on commit 087f640

Please sign in to comment.