start working on error handling stuff

This commit is contained in:
dfsek
2025-12-29 22:18:44 -07:00
parent 9a16336f53
commit cb08401536
76 changed files with 212 additions and 165 deletions
@@ -149,7 +149,7 @@ public class VanillaOre implements Structure {
if(!visited.get(index)) { // Skip blocks that have already been visited
visited.set(index);
BlockType block = world.getBlockState(xi, yi, zi).getBlockType();
BlockType block = world.getBlockState(xi, yi, zi).blockType();
if(shouldPlace(getReplaceable(), block, exposed, random, world, xi, yi, zi)) {
world.setBlockState(xi, yi, zi, getMaterial(block), isApplyGravity());
++blockCount;
@@ -31,7 +31,7 @@ public class VanillaScatteredOre extends VanillaOre {
for(int j = 0; j < i; ++j) {
this.setPos(mutable, random, location, Math.min(j, spread));
BlockType block = world.getBlockState(mutable).getBlockType();
BlockType block = world.getBlockState(mutable).blockType();
if(shouldPlace(getReplaceable(), block, exposed, random, world, mutable.getX(), mutable.getY(), mutable.getZ())) {
world.setBlockState(mutable, getMaterial(block), isApplyGravity());
}
@@ -21,12 +21,12 @@ public class VanillaOreUtils {
if(!replaceable.contains(type)) return false;
if(shouldExpose(random, exposedChance)) return true; // Exposed blocks can be placed regardless of adjacency to air
// Adjacency is checked after determining not exposed rather than vice-versa, assuming block checks are more expensive
boolean adjacentAir = world.getBlockState(x, y, z - 1).isAir() ||
world.getBlockState(x, y, z + 1).isAir() ||
world.getBlockState(x, y - 1, z).isAir() ||
world.getBlockState(x, y + 1, z).isAir() ||
world.getBlockState(x - 1, y, z).isAir() ||
world.getBlockState(x + 1, y, z).isAir();
boolean adjacentAir = world.getBlockState(x, y, z - 1).air() ||
world.getBlockState(x, y, z + 1).air() ||
world.getBlockState(x, y - 1, z).air() ||
world.getBlockState(x, y + 1, z).air() ||
world.getBlockState(x - 1, y, z).air() ||
world.getBlockState(x + 1, y, z).air();
return !adjacentAir; // Exposed check did not pass earlier so only blocks not adjacent air should place
}
}