diff --git a/src/main/java/twilightforest/world/TFTeleporter.java b/src/main/java/twilightforest/world/TFTeleporter.java index b6a9e6b417..ed1dca9f92 100644 --- a/src/main/java/twilightforest/world/TFTeleporter.java +++ b/src/main/java/twilightforest/world/TFTeleporter.java @@ -179,9 +179,9 @@ private static int getScanHeight(ServerLevel world, BlockPos pos) { private static int getScanHeight(ServerLevel world, int x, int z) { int worldHeight = world.getMaxY() - 1; - //FIXME find an alternative to getHighestSectionPosition, its marked for removal - @SuppressWarnings("removal") - int chunkHeight = world.getChunk(x >> 4, z >> 4).getHighestSectionPosition() + 15; + LevelChunk chunk = world.getChunk(x >> 4, z >> 4); + int chunkHeightIndex = chunk.getHighestFilledSectionIndex(); + int chunkHeight = (chunkHeightIndex == -1 ? chunk.getMinY() : SectionPos.sectionToBlockCoord(chunk.getSectionIndexFromSectionY(chunkHeightIndex))) + 15; return Math.min(worldHeight, chunkHeight); }