SPIGOT-5556: Some biome methods use incorrect positions

See SPIGOT-5529
This commit is contained in:
md_5 2020-02-01 17:30:40 +11:00
parent 544ccdc588
commit e82b5477ae
2 changed files with 6 additions and 6 deletions

View file

@ -126,7 +126,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
Preconditions.checkState(biome != null, "ChunkSnapshot created without biome. Please call getSnapshot with includeBiome=true");
CraftChunk.validateChunkCoordinates(x, y, z);
return CraftBlock.biomeBaseToBiome(biome.getBiome(x, y, z));
return CraftBlock.biomeBaseToBiome(biome.getBiome(x >> 2, y >> 2, z >> 2));
}
@Override
@ -139,7 +139,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
Preconditions.checkState(biome != null, "ChunkSnapshot created without biome. Please call getSnapshot with includeBiome=true");
CraftChunk.validateChunkCoordinates(x, y, z);
return biome.getBiome(x, y, z).getAdjustedTemperature(new BlockPosition((this.x << 4) | x, y, (this.z << 4) | z));
return biome.getBiome(x >> 2, y >> 2, z >> 2).getAdjustedTemperature(new BlockPosition((this.x << 4) | x, y, (this.z << 4) | z));
}
@Override

View file

@ -901,7 +901,7 @@ public class CraftWorld implements World {
@Override
public Biome getBiome(int x, int y, int z) {
return CraftBlock.biomeBaseToBiome(this.world.getBiome(new BlockPosition(x, y, z)));
return CraftBlock.biomeBaseToBiome(this.world.getBiome(x >> 2, y >> 2, z >> 2));
}
@Override
@ -919,7 +919,7 @@ public class CraftWorld implements World {
net.minecraft.server.Chunk chunk = this.world.getChunkAtWorldCoords(pos);
if (chunk != null) {
chunk.getBiomeIndex().setBiome(x, y, z, bb);
chunk.getBiomeIndex().setBiome(x >> 2, y >> 2, z >> 2, bb);
chunk.markDirty(); // SPIGOT-2890
}
@ -934,7 +934,7 @@ public class CraftWorld implements World {
@Override
public double getTemperature(int x, int y, int z) {
BlockPosition pos = new BlockPosition(x, y, z);
return this.world.getBiome(pos).getAdjustedTemperature(pos);
return this.world.getBiome(x >> 2, y >> 2, z >> 2).getAdjustedTemperature(pos);
}
@Override
@ -944,7 +944,7 @@ public class CraftWorld implements World {
@Override
public double getHumidity(int x, int y, int z) {
return this.world.getBiome(new BlockPosition(x, y, z)).getHumidity();
return this.world.getBiome(x >> 2, y >> 2, z >> 2).getHumidity();
}
@Override