From 3ded16f6e5f9b8e3314c939095cfe00efd95c197 Mon Sep 17 00:00:00 2001 From: TheMode Date: Tue, 22 Jun 2021 00:11:47 +0200 Subject: [PATCH] Fix negative sections --- src/main/java/net/minestom/server/instance/Chunk.java | 4 ---- .../java/net/minestom/server/instance/palette/Palette.java | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/net/minestom/server/instance/Chunk.java b/src/main/java/net/minestom/server/instance/Chunk.java index 6fefe34a3..65d9fbaab 100644 --- a/src/main/java/net/minestom/server/instance/Chunk.java +++ b/src/main/java/net/minestom/server/instance/Chunk.java @@ -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; diff --git a/src/main/java/net/minestom/server/instance/palette/Palette.java b/src/main/java/net/minestom/server/instance/palette/Palette.java index 140aea661..4943fea63 100644 --- a/src/main/java/net/minestom/server/instance/palette/Palette.java +++ b/src/main/java/net/minestom/server/instance/palette/Palette.java @@ -277,7 +277,7 @@ public class Palette implements PublicCloneable { * @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; }