Misc Perf improvements

This commit is contained in:
Bud Gidiere
2020-11-20 20:49:10 -06:00
parent 28109bf999
commit ab906b47c8
9 changed files with 27 additions and 29 deletions

View File

@@ -66,14 +66,15 @@ public class CavePopulator extends BlockPopulator {
updateNeeded.add(b);
}
}
for(Location l : shiftCandidate.keySet()) {
for(Map.Entry<Location, Material> entry : shiftCandidate.entrySet()) {
Location l = entry.getKey();
Location mut = l.clone();
Material orig = l.getBlock().getType();
do mut.subtract(0, 1, 0);
while(mut.getBlock().getType().equals(orig));
try {
if(c.getShiftedBlocks().get(shiftCandidate.get(l)).contains(mut.getBlock().getType())) {
mut.getBlock().setBlockData(shiftStorage.computeIfAbsent(shiftCandidate.get(l), Material::createBlockData), false);
if(c.getShiftedBlocks().get(entry.getValue()).contains(mut.getBlock().getType())) {
mut.getBlock().setBlockData(shiftStorage.computeIfAbsent(entry.getValue(), Material::createBlockData), false);
}
} catch(NullPointerException ignore) {
}

View File

@@ -36,8 +36,8 @@ public class OrePopulator extends GaeaBlockPopulator {
OreConfig ore = e.getKey();
int edgeOffset = ore.getChunkEdgeOffset();
for(int i = 0; i < num; i++) {
int x = random.nextInt(16 - edgeOffset * 2) + edgeOffset;
int z = random.nextInt(16 - edgeOffset * 2) + edgeOffset;
int x = random.nextInt(16 - (edgeOffset << 1)) + edgeOffset;
int z = random.nextInt(16 - (edgeOffset << 1)) + edgeOffset;
int y = ores.getOreHeights().get(ore).get(random);
Vector v = new Vector(x, y, z);