diff --git a/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainNormalActuator.java b/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainNormalActuator.java index ef1ca77d3..56fce5f95 100644 --- a/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainNormalActuator.java +++ b/src/main/java/com/volmit/iris/engine/actuator/IrisTerrainNormalActuator.java @@ -66,70 +66,6 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator getEngine().getMetrics().getTerrain().put(p.getMilliseconds()); } - public void generateGround(int realX, int realZ, int xf, int zf, Hunk h, int surface, int bottom, int height, int fluidOrHeight, IrisBiome biome) - { - if(surface == bottom || surface-1 == bottom) - { - return; - } - - KList blocks = null; - KList fblocks = null; - int depth,fdepth; - - for (int i = surface; i >= bottom; i--) { - if (i >= h.getHeight()) { - continue; - } - - if (i == 0) { - if (getDimension().isBedrock()) { - h.set(xf, i, zf, BEDROCK); - lastBedrock = i; - continue; - } - } - - if (carving && getDimension().isCarved(getData(), realX, i, realZ, rng, height)) { - continue; - } - - if (getDimension().getCaverns() != null && getDimension().getCaverns().isCavern(rng, realX, i, realZ, height, getData())) { - continue; - } - - if (i > height && i <= fluidOrHeight) { - fdepth = fluidOrHeight - i; - - if (fblocks == null) { - fblocks = biome.generateSeaLayers(realX, realZ, rng, fluidOrHeight - height, getData()); - } - - if (fblocks.hasIndex(fdepth)) { - h.set(xf, i, zf, fblocks.get(fdepth)); - continue; - } - - h.set(xf, i, zf, getComplex().getFluidStream().get(realX, +realZ)); - continue; - } - - if (i <= height) { - depth = surface - i; - if (blocks == null) { - blocks = biome.generateLayers(realX, realZ, rng, surface - bottom, surface, getData(), getComplex()); - } - - if (blocks.hasIndex(depth)) { - h.set(xf, i, zf, blocks.get(depth)); - continue; - } - - h.set(xf, i, zf, getComplex().getRockStream().get(realX, realZ)); - } - } - } - private int fluidOrHeight(int height) { return Math.max(getDimension().getFluidHeight(), height); @@ -145,12 +81,12 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator */ @BlockCoordinates public void terrainSliver(int x, int z, int xf, Hunk h) { - int i, realX, realZ, hf, he; + int zf, realX, realZ, hf, he; IrisBiome biome; - for (i = 0; i < h.getDepth(); i++) { + for (zf = 0; zf < h.getDepth(); zf++) { realX = (int) modX(xf + x); - realZ = (int) modZ(i + z); + realZ = (int) modZ(zf + z); biome = getComplex().getTrueBiomeStream().get(realX, realZ); he = (int) Math.round(Math.min(h.getHeight(), getComplex().getHeightStream().get(realX, realZ))); hf = Math.round(Math.max(Math.min(h.getHeight(), getDimension().getFluidHeight()), he)); @@ -159,7 +95,65 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator continue; } - generateGround(realX, realZ, xf, i, h, hf, 0, he, hf, biome); + KList blocks = null; + KList fblocks = null; + int depth,fdepth; + + for (int i = hf; i >= 0; i--) { + if (i >= h.getHeight()) { + continue; + } + + if (i == 0) { + if (getDimension().isBedrock()) { + h.set(xf, i, zf, BEDROCK); + lastBedrock = i; + continue; + } + } + + if (carving && getDimension().isCarved(getData(), realX, i, realZ, rng, he)) { + continue; + } + + if (getDimension().getCaverns() != null && getDimension().getCaverns().isCavern(rng, realX, i, realZ, he, getData())) { + continue; + } + + if (i > he && i <= hf) { + fdepth = hf - i; + + if (fblocks == null) { + fblocks = biome.generateSeaLayers(realX, realZ, rng, hf - he, getData()); + } + + if (fblocks.hasIndex(fdepth)) { + h.set(xf, i, zf, fblocks.get(fdepth)); + continue; + } + + h.set(xf, i, zf, getComplex().getFluidStream().get(realX, +realZ)); + continue; + } + + if (i <= he) { + depth = he - i; + if (blocks == null) { + blocks = biome.generateLayers(realX, realZ, rng, + he, + he, + getData(), + getComplex()); + } + + if (blocks.hasIndex(depth)) { + h.set(xf, i, zf, blocks.get(depth)); + continue; + } + + h.set(xf, i, zf, getComplex().getRockStream().get(realX, realZ)); + } + } } } }