Some tweaks / optimizations

This commit is contained in:
Jesse Boyd
2017-09-25 16:57:42 +10:00
parent 92f94ecedc
commit 0d608245f5
15 changed files with 173 additions and 30 deletions

View File

@ -187,7 +187,7 @@ public class BukkitUtil extends WorldUtil {
if (block != null) {
Material type = block.getType();
if (type.isSolid()) {
if (air > 1) return y + 1;
if (air > 1) return y;
air = 0;
} else {
switch (type) {
@ -201,7 +201,7 @@ public class BukkitUtil extends WorldUtil {
}
}
}
return bukkitWorld.getMaxHeight();
return bukkitWorld.getMaxHeight() - 1;
}
@Override

View File

@ -6,6 +6,7 @@ import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue;
import com.plotsquared.bukkit.util.BukkitUtil;
import java.util.Arrays;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
@ -72,6 +73,24 @@ public class GenChunk extends ScopedLocalBlockQueue {
}
}
@Override
public void setCuboid(Location pos1, Location pos2, PlotBlock block) {
if (block.data == 0 && result != null && pos1.getX() == 0 && pos1.getZ() == 0 && pos2.getX() == 15 && pos2.getZ() == 15) {
for (int y = pos1.getY(); y <= pos2.getY(); y++) {
int layer = y >> 4;
short[] data = result[layer];
if (data == null) {
result[layer] = data = new short[4096];
}
int start = y << 8;
int end = start + 256;
Arrays.fill(data, start, end, block.id);
}
} else {
super.setCuboid(pos1, pos2, block);
}
}
@Override
public boolean setBiome(int x, int z, String biome) {
return setBiome(x, z, Biome.valueOf(biome.toUpperCase()));