-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor
-
None
-
Affects Version/s: None
-
None
-
Environment:
MC Version 1.17.1, Latest Spigot Build
-
This server is running CraftBukkit version 3203-Spigot-18c71bf-aa69d1c (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT)
-
Yes
I am trying to work out the max height of a chunk, so rather than getting the height of all blocks in the chunk, i decided to use this method.
It seems that it has a "memory" for when blocks are placed very high up, and does not immediately purge them. So a block could be temporarily placed very high up and it is not until a server restart that it is lowered back down to the actual height.
private int getChunkHeight(final int chunkX, final int chunkZ) { ChunkSnapshot chunkSnapshot = this.world.getChunkAt(chunkX,chunkZ).getChunkSnapshot(); for (int y = 15; y >= 0; y--) { if (!chunkSnapshot.isSectionEmpty(y)) { return y+1; } } return 16; }
This code will return 16 if a block was placed at y 255 and then removed