Switch from MainUtil

This commit is contained in:
dordsor21 2020-07-19 14:37:42 +01:00
parent d2443f6de8
commit 21693e344c
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
3 changed files with 13 additions and 12 deletions

View File

@ -34,7 +34,7 @@ import com.plotsquared.core.queue.BasicQueueCoordinator;
import com.plotsquared.core.queue.ChunkCoordinator; import com.plotsquared.core.queue.ChunkCoordinator;
import com.plotsquared.core.queue.LocalChunk; import com.plotsquared.core.queue.LocalChunk;
import com.plotsquared.core.util.BlockUtil; 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.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
@ -145,9 +145,9 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
continue; continue;
} }
BaseBlock block = blocksLayer[j]; BaseBlock block = blocksLayer[j];
int x = sx + MainUtil.x_loc[layer][j]; int x = sx + ChunkUtil.getX(j);
int y = MainUtil.y_loc[layer][j]; int y = ChunkUtil.getY(layer, j);
int z = sz + MainUtil.z_loc[layer][j]; int z = sz + ChunkUtil.getZ(j);
setWorldBlock(x, y, z, block, blockVector2); setWorldBlock(x, y, z, block, blockVector2);
} }
} }
@ -161,9 +161,9 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
continue; continue;
} }
BiomeType biome = biomesLayer[j]; BiomeType biome = biomesLayer[j];
int x = sx + MainUtil.x_loc[layer][j]; int x = sx + ChunkUtil.getX(j);
int y = MainUtil.y_loc[layer][j]; int y = ChunkUtil.getY(layer, j);
int z = sz + MainUtil.z_loc[layer][j]; int z = sz + ChunkUtil.getZ(j);
world.setBiome(BlockVector3.at(x, y, z), biome); world.setBiome(BlockVector3.at(x, y, z), biome);
} }
} }

View File

@ -473,7 +473,7 @@ public class BukkitRegionManager extends RegionManager {
queue.setChunkConsumer(blockVector2 -> { queue.setChunkConsumer(blockVector2 -> {
final int cx = blockVector2.getX() << 4; final int cx = blockVector2.getX() << 4;
final int cz = blockVector2.getZ() << 4; final int cz = blockVector2.getZ() << 4;
MainUtil WorldUtil
.setBiome(world, Math.max(minX, cx), Math.max(minZ, cz), Math.min(maxX, cx + 15), .setBiome(world, Math.max(minX, cx), Math.max(minZ, cz), Math.min(maxX, cx + 15),
Math.min(maxZ, cz + 15), biome); Math.min(maxZ, cz + 15), biome);
worldUtil.refreshChunk(blockVector2.getBlockX(), blockVector2.getBlockZ(), world); worldUtil.refreshChunk(blockVector2.getBlockX(), blockVector2.getBlockZ(), world);

View File

@ -1,5 +1,6 @@
package com.plotsquared.core.queue; package com.plotsquared.core.queue;
import com.plotsquared.core.util.ChunkUtil;
import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.sk89q.jnbt.CompoundTag; 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) { 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 i = y >> 4;
final int j = MainUtil.CACHE_J[y][x][z]; final int j = ChunkUtil.getJ(x, y, z);
BiomeType[] array = this.biomes[i]; BiomeType[] array = this.biomes[i];
if (array == null) { if (array == null) {
array = this.biomes[i] = new BiomeType[4096]; 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) { 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 i = y >> 4;
final int j = MainUtil.CACHE_J[y][x][z]; final int j = ChunkUtil.getJ(x, y, z);
BaseBlock[] array = baseblocks[i]; BaseBlock[] array = baseblocks[i];
if (array == null) { if (array == null) {
array = (baseblocks[i] = new BaseBlock[4096]); array = (baseblocks[i] = new BaseBlock[4096]);