From 21693e344cf2b9b3443df904d2d50af9f2596989 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 19 Jul 2020 14:37:42 +0100 Subject: [PATCH] Switch from MainUtil --- .../bukkit/queue/BukkitQueueCoordinator.java | 14 +++++++------- .../bukkit/util/BukkitRegionManager.java | 2 +- .../com/plotsquared/core/queue/LocalChunk.java | 9 +++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java index db140051d..cdb8a7b5e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java @@ -34,7 +34,7 @@ import com.plotsquared.core.queue.BasicQueueCoordinator; import com.plotsquared.core.queue.ChunkCoordinator; import com.plotsquared.core.queue.LocalChunk; import com.plotsquared.core.util.BlockUtil; -import com.plotsquared.core.util.MainUtil; +import com.plotsquared.core.util.ChunkUtil; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.bukkit.BukkitAdapter; @@ -145,9 +145,9 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { continue; } BaseBlock block = blocksLayer[j]; - int x = sx + MainUtil.x_loc[layer][j]; - int y = MainUtil.y_loc[layer][j]; - int z = sz + MainUtil.z_loc[layer][j]; + int x = sx + ChunkUtil.getX(j); + int y = ChunkUtil.getY(layer, j); + int z = sz + ChunkUtil.getZ(j); setWorldBlock(x, y, z, block, blockVector2); } } @@ -161,9 +161,9 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { continue; } BiomeType biome = biomesLayer[j]; - int x = sx + MainUtil.x_loc[layer][j]; - int y = MainUtil.y_loc[layer][j]; - int z = sz + MainUtil.z_loc[layer][j]; + int x = sx + ChunkUtil.getX(j); + int y = ChunkUtil.getY(layer, j); + int z = sz + ChunkUtil.getZ(j); world.setBiome(BlockVector3.at(x, y, z), biome); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java index ca1caa09e..795a4cab9 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java @@ -473,7 +473,7 @@ public class BukkitRegionManager extends RegionManager { queue.setChunkConsumer(blockVector2 -> { final int cx = blockVector2.getX() << 4; final int cz = blockVector2.getZ() << 4; - MainUtil + WorldUtil .setBiome(world, Math.max(minX, cx), Math.max(minZ, cz), Math.min(maxX, cx + 15), Math.min(maxZ, cz + 15), biome); worldUtil.refreshChunk(blockVector2.getBlockX(), blockVector2.getBlockZ(), world); diff --git a/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java b/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java index af6a30fe3..176e4f083 100644 --- a/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java +++ b/Core/src/main/java/com/plotsquared/core/queue/LocalChunk.java @@ -1,5 +1,6 @@ package com.plotsquared.core.queue; +import com.plotsquared.core.util.ChunkUtil; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.sk89q.jnbt.CompoundTag; @@ -51,8 +52,8 @@ public class LocalChunk { } public void setBiome(final int x, final int y, final int z, final BiomeType biomeType) { - final int i = MainUtil.CACHE_I[y][x][z]; - final int j = MainUtil.CACHE_J[y][x][z]; + final int i = y >> 4; + final int j = ChunkUtil.getJ(x, y, z); BiomeType[] array = this.biomes[i]; if (array == null) { array = this.biomes[i] = new BiomeType[4096]; @@ -65,8 +66,8 @@ public class LocalChunk { } public void setBlock(final int x, final int y, final int z, final BaseBlock baseBlock) { - final int i = MainUtil.CACHE_I[y][x][z]; - final int j = MainUtil.CACHE_J[y][x][z]; + final int i = y >> 4; + final int j = ChunkUtil.getJ(x, y, z); BaseBlock[] array = baseblocks[i]; if (array == null) { array = (baseblocks[i] = new BaseBlock[4096]);