Fixed tpbiome dropping you underneath the world

This commit is contained in:
Adubbz 2019-05-19 20:35:56 +10:00
parent f439032546
commit 6c4a11b15e

View file

@ -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);
}
}