mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Move IJ/xyz cache out of MainUItil to its own class
This commit is contained in:
@ -36,7 +36,6 @@ import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.World;
|
||||
@ -74,7 +73,6 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
this.populators = new ArrayList<>();
|
||||
this.populators.add(new BlockStatePopulator(this.plotGenerator, this.plotAreaManager));
|
||||
this.full = true;
|
||||
MainUtil.initCache();
|
||||
}
|
||||
|
||||
public BukkitPlotGenerator(final String world, final ChunkGenerator cg, @Nonnull final PlotAreaManager plotAreaManager) {
|
||||
@ -87,7 +85,6 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
this.full = false;
|
||||
this.platformGenerator = cg;
|
||||
this.plotGenerator = new DelegatePlotGenerator(cg, world);
|
||||
MainUtil.initCache();
|
||||
}
|
||||
|
||||
@Override public void augment(PlotArea area) {
|
||||
|
@ -31,7 +31,7 @@ import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.core.location.ChunkWrapper;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.ChunkUtil;
|
||||
import com.plotsquared.core.util.PatternUtil;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
@ -151,12 +151,12 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
||||
}
|
||||
|
||||
private void storeCache(final int x, final int y, final int z, final BlockState id) {
|
||||
int i = MainUtil.CACHE_I[y][x][z];
|
||||
int i = y >> 4;
|
||||
BlockState[] v = this.result[i];
|
||||
if (v == null) {
|
||||
this.result[i] = v = new BlockState[4096];
|
||||
}
|
||||
int j = MainUtil.CACHE_J[y][x][z];
|
||||
int j = ChunkUtil.getJ(x, y, z);
|
||||
v[j] = id;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
||||
}
|
||||
|
||||
@Override public BlockState getBlock(int x, int y, int z) {
|
||||
int i = MainUtil.CACHE_I[y][x][z];
|
||||
int i = y >> 4;
|
||||
if (result == null) {
|
||||
return BukkitBlockUtil.get(chunkData.getType(x, y, z));
|
||||
}
|
||||
@ -179,7 +179,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
||||
if (array == null) {
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
int j = MainUtil.CACHE_J[y][x][z];
|
||||
int j = ChunkUtil.getJ(x, y, z);
|
||||
return array[j];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user