Skip to content

Commit

Permalink
fix: fix fleshkin chest not resisting explosions
Browse files Browse the repository at this point in the history
  • Loading branch information
Elenterius committed Jun 16, 2023
1 parent dee8207 commit ccfd1be
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.*;
Expand Down Expand Up @@ -173,6 +174,16 @@ public void playerWillDestroy(Level level, BlockPos pos, BlockState state, Playe
super.playerWillDestroy(level, pos, state, player);
}

@Override
public boolean canDropFromExplosion(BlockState state, BlockGetter level, BlockPos pos, Explosion explosion) {
return false;
}

@Override
public void onBlockExploded(BlockState state, Level level, BlockPos pos, Explosion explosion) {
//ignore the explosion, the block is not destroyed
}

@Override
public float getDestroyProgress(BlockState state, Player player, BlockGetter level, BlockPos pos) {
if (level.getBlockEntity(pos) instanceof IRestrictedInteraction interaction && interaction.isActionAllowed(player, Actions.DESTROY_BLOCK)) {
Expand Down

0 comments on commit ccfd1be

Please sign in to comment.