From 6c4a11b15ef621967f4e827628b258453421475b Mon Sep 17 00:00:00 2001 From: Adubbz Date: Sun, 19 May 2019 20:35:56 +1000 Subject: [PATCH] Fixed tpbiome dropping you underneath the world --- .../java/biomesoplenty/common/util/block/BlockUtil.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/biomesoplenty/common/util/block/BlockUtil.java b/src/main/java/biomesoplenty/common/util/block/BlockUtil.java index 3c1df8d3b..2f99cdaff 100644 --- a/src/main/java/biomesoplenty/common/util/block/BlockUtil.java +++ b/src/main/java/biomesoplenty/common/util/block/BlockUtil.java @@ -16,6 +16,8 @@ import net.minecraft.state.IProperty; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunk; import net.minecraft.world.gen.Heightmap; import javax.annotation.Nullable; @@ -39,8 +41,7 @@ public class BlockUtil public static BlockPos getTopSolidOrLiquidBlock(IWorld world, int x, int z) { - BlockPos blockpos = new BlockPos(x, world.getHeight(Heightmap.Type.WORLD_SURFACE, x, z), z); - BlockPos blockpos1 = blockpos.down(); - return world.getBlockState(blockpos1).allowsMovement(world, blockpos1, PathType.LAND) ? blockpos1 : blockpos; + IChunk chunk = world.getChunk(x >> 4, z >> 4); + return new BlockPos(x, chunk.getTopBlockY(Heightmap.Type.MOTION_BLOCKING, x & 15, z & 15), z); } }