Skip to content

Commit

Permalink
Fix Dying on bedrock does not generate a gravestone
Browse files Browse the repository at this point in the history
  • Loading branch information
PTOM76 committed Jul 3, 2022
1 parent aca8d16 commit dbe8e9c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/net/guavy/gravestones/Gravestones.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public static void placeGrave(World world, Vec3d pos, PlayerEntity player) {

BlockPos blockPos = new BlockPos(pos.x, pos.y - 1, pos.z);

if(blockPos.getY() < world.getDimension().minY()) {
blockPos = new BlockPos(blockPos.getX(), world.getDimension().minY() + 1, blockPos.getZ());
}

BlockState blockState = world.getBlockState(blockPos);
Block block = blockState.getBlock();

Expand All @@ -96,9 +100,6 @@ public static void placeGrave(World world, Vec3d pos, PlayerEntity player) {
player.totalExperience = 0;
player.experienceProgress = 0;
player.experienceLevel = 0;
if(blockPos.getY() + 1 < world.getDimension().minY()) {
blockPos = new BlockPos(blockPos.getX(), 10, blockPos.getZ());
}

boolean placed = false;

Expand Down Expand Up @@ -141,7 +142,7 @@ private static boolean canPlaceGravestone(World world, Block block, BlockPos blo

if(blackListedBlocks.contains(block)) return false;

return !(blockPos.getY() + 1 < world.getDimension().minY() || blockPos.getY() > world.getDimension().height() - world.getDimension().minY());
return !(blockPos.getY() < world.getDimension().minY() || blockPos.getY() > world.getDimension().height() - world.getDimension().minY());
}
}

0 comments on commit dbe8e9c

Please sign in to comment.