mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-24 08:12:32 +01:00
Potentially fix coordinates
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
4bc36f574e
commit
998fc6653b
@ -64,7 +64,7 @@ public class DynamicChunk extends Chunk {
|
||||
columnarOcclusionFieldList.onBlockChanged(x, y, z, blockDescription, 0);
|
||||
}
|
||||
Section section = getSectionAt(y);
|
||||
section.blockPalette().set(toChunkRelativeCoordinate(x), y, toChunkRelativeCoordinate(z), block.stateId());
|
||||
section.blockPalette().set(toChunkRelativeCoordinate(x), y / 16, toChunkRelativeCoordinate(z), block.stateId());
|
||||
|
||||
final int index = ChunkUtils.getBlockIndex(x, y, z);
|
||||
// Handler
|
||||
@ -86,7 +86,7 @@ public class DynamicChunk extends Chunk {
|
||||
public void setBiome(int x, int y, int z, @NotNull Biome biome) {
|
||||
this.chunkCache.invalidate();
|
||||
Section section = getSectionAt(y);
|
||||
section.biomePalette().set(toChunkRelativeCoordinate(x) / 4, y / 4, toChunkRelativeCoordinate(x) / 4, biome.id());
|
||||
section.biomePalette().set(toChunkRelativeCoordinate(x) / 4, y / 4 / 16, toChunkRelativeCoordinate(z) / 4, biome.id());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -123,7 +123,7 @@ public class DynamicChunk extends Chunk {
|
||||
// Retrieve the block from state id
|
||||
final Section section = sections[ChunkUtils.getSectionAt(y) + minSection];
|
||||
if (section == null) return Block.AIR; // Section is unloaded
|
||||
final int blockStateId = section.blockPalette().get(toChunkRelativeCoordinate(x), y, toChunkRelativeCoordinate(z));
|
||||
final int blockStateId = section.blockPalette().get(toChunkRelativeCoordinate(x), y / 16, toChunkRelativeCoordinate(z));
|
||||
if (blockStateId == -1) return Block.AIR; // Section is empty
|
||||
return Objects.requireNonNullElse(Block.fromStateId((short) blockStateId), Block.AIR);
|
||||
}
|
||||
@ -132,7 +132,7 @@ public class DynamicChunk extends Chunk {
|
||||
public @NotNull Biome getBiome(int x, int y, int z) {
|
||||
final Section section = sections[ChunkUtils.getSectionAt(y) + minSection];
|
||||
if (section == null) return Biome.PLAINS; // Section is unloaded
|
||||
final int id = section.biomePalette().get(toChunkRelativeCoordinate(x), y, toChunkRelativeCoordinate(z));
|
||||
final int id = section.biomePalette().get(toChunkRelativeCoordinate(x) / 4, y / 4 / 16, toChunkRelativeCoordinate(z) / 4);
|
||||
return MinecraftServer.getBiomeManager().getById(id);
|
||||
}
|
||||
|
||||
@ -154,9 +154,8 @@ public class DynamicChunk extends Chunk {
|
||||
sendPacketToViewers(chunkCache.retrieve());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Chunk copy(@NotNull Instance instance, int chunkX, int chunkZ) {
|
||||
public @NotNull Chunk copy(@NotNull Instance instance, int chunkX, int chunkZ) {
|
||||
DynamicChunk dynamicChunk = new DynamicChunk(instance, chunkX, chunkZ);
|
||||
Arrays.setAll(dynamicChunk.sections, value -> {
|
||||
final Section s = sections[value];
|
||||
|
Loading…
Reference in New Issue
Block a user