mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-24 13:31:33 +00:00
start working on error handling stuff
This commit is contained in:
+1
-1
@@ -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;
|
||||
|
||||
+1
-1
@@ -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());
|
||||
}
|
||||
|
||||
+6
-6
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user