-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
None
-
This server is running CraftBukkit version 3608-Spigot-6198b5a-b5aa0be (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT)
-
Yes
The biomes in a chunk snapshot do not match the biome of the world chunk when accessed with their respective getBiome(x,y,z) methods.
I tried to work out why this was and it seems that the Y coordinate lookup in the chunk snapshot is causing the issue. I noticed some patterns from experimentation and found that if I multiply the Y coordinate by 4 (limiting the min and max size appropriately) before asking for the snapshot biome it gives the right biome - most of the time.
Here's my test plugin code. This compares Chunk 0,0 of the default world. I tried the flag that includes the maxY value when getting the chunk snapshot but that had no effect.
public class TestPlugin extends JavaPlugin { @Override public void onEnable() { getLogger().info("Test plugin loaded"); World w = Bukkit.getWorld("world"); Chunk c = w.getChunkAt(0, 0); ChunkSnapshot snapshot = c.getChunkSnapshot(false, true, false); // Compare chunk and chunk snapshot biomes for (int y = w.getMinHeight(); y < w.getMaxHeight(); y++) { if (!w.getBiome(0, y, 0).equals(snapshot.getBiome(0, y, 0))) { // This should not be printed if the biomes matchs getLogger().info("Mismatch at " + y + " " + w.getBiome(0, y, 0) + " not equals " + snapshot.getBiome(0, y, 0)); } // Work around attempt // Multiply y coord by 4 - this makes it work (most of the time)... int yy = y * 4; // Avoid the mix max check if (yy > w.getMinHeight() && yy < w.getMaxHeight()) { if (!w.getBiome(0, y, 0).equals(snapshot.getBiome(0, yy, 0))) { // This should not be printed if this work around works (most of the time) getLogger().info("4x test - Mismatch at " + y + " " + w.getBiome(0, y, 0) + " not equals " + snapshot.getBiome(0, yy, 0)); } } } } }