Fix negative sections

This commit is contained in:
TheMode 2021-06-22 00:11:47 +02:00
parent 2af150c1f0
commit 3ded16f6e5
2 changed files with 1 additions and 5 deletions

View File

@ -1,6 +1,5 @@
package net.minestom.server.instance;
import net.minestom.server.MinecraftServer;
import net.minestom.server.Tickable;
import net.minestom.server.Viewable;
import net.minestom.server.data.Data;
@ -25,7 +24,6 @@ import net.minestom.server.utils.chunk.ChunkSupplier;
import net.minestom.server.utils.chunk.ChunkUtils;
import net.minestom.server.utils.player.PlayerUtils;
import net.minestom.server.world.biomes.Biome;
import net.minestom.server.world.biomes.BiomeManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -50,8 +48,6 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public abstract class Chunk implements BlockGetter, BlockSetter, Viewable, Tickable, DataContainer {
protected static final BiomeManager BIOME_MANAGER = MinecraftServer.getBiomeManager();
public static final int CHUNK_SIZE_X = 16;
public static final int CHUNK_SIZE_Z = 16;
public static final int CHUNK_SECTION_SIZE = 16;

View File

@ -277,7 +277,7 @@ public class Palette implements PublicCloneable<Palette> {
* @return the section index of the position
*/
public static int getSectionIndex(int x, int y, int z) {
y %= CHUNK_SECTION_SIZE;
y = Math.floorMod(y, CHUNK_SECTION_SIZE);
return y << 8 | z << 4 | x;
}