From 7505d645eb81d7767c2ead9b624b3e83bfa10160 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 26 Jul 2020 13:24:54 -0400 Subject: [PATCH] Fix --- .../iris/generator/TerrainChunkGenerator.java | 13 +++++++++---- .../ninja/bytecode/iris/object/DecorationPart.java | 1 + .../bytecode/iris/object/IrisBiomeDecorator.java | 2 +- .../java/ninja/bytecode/iris/object/IrisObject.java | 5 +++++ .../bytecode/iris/object/IrisObjectPlacement.java | 3 +++ .../ninja/bytecode/iris/util/IObjectPlacer.java | 2 ++ 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/main/java/ninja/bytecode/iris/generator/TerrainChunkGenerator.java b/src/main/java/ninja/bytecode/iris/generator/TerrainChunkGenerator.java index 4316ee765..34003ab57 100644 --- a/src/main/java/ninja/bytecode/iris/generator/TerrainChunkGenerator.java +++ b/src/main/java/ninja/bytecode/iris/generator/TerrainChunkGenerator.java @@ -98,12 +98,12 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator sliver.set(k, block); - if(k == height && block.getMaterial().isSolid() && k < fluidHeight && biome.isSea()) + if(k == height && block.getMaterial().isSolid() && k < fluidHeight) { decorateUnderwater(biome, sliver, wx, k, wz, rx, rz, block); } - if(k == Math.max(height, fluidHeight) && block.getMaterial().isSolid() && k < 255 && !biome.isSea()) + if(k == Math.max(height, fluidHeight) && block.getMaterial().isSolid() && k < 255 && k > fluidHeight) { decorateLand(biome, sliver, wx, k, wz, rx, rz, block); } @@ -238,14 +238,14 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator if(stack == 1) { - sliver.set(y + 1, d); + sliver.set(i.getPartOf().equals(DecorationPart.SEA_SURFACE) ? (getFluidHeight() + 1) : (y + 1), d); } else if(y < getFluidHeight() - stack) { for(int l = 0; l < stack; l++) { - sliver.set(y + l + 1, d); + sliver.set(i.getPartOf().equals(DecorationPart.SEA_SURFACE) ? (getFluidHeight() + 1 + l) : (y + l + 1), d); } } @@ -363,6 +363,11 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator return isFluidAtHeight(rx + 1, rz) || isFluidAtHeight(rx - 1, rz) || isFluidAtHeight(rx, rz - 1) || isFluidAtHeight(rx, rz + 1); } + public boolean isUnderwater(int x, int z) + { + return isFluidAtHeight(x, z); + } + public boolean isFluidAtHeight(int x, int z) { return Math.round(getTerrainHeight(x, z)) < getFluidHeight(); diff --git a/src/main/java/ninja/bytecode/iris/object/DecorationPart.java b/src/main/java/ninja/bytecode/iris/object/DecorationPart.java index cd141fb2e..ae608797a 100644 --- a/src/main/java/ninja/bytecode/iris/object/DecorationPart.java +++ b/src/main/java/ninja/bytecode/iris/object/DecorationPart.java @@ -4,4 +4,5 @@ public enum DecorationPart { NONE, SHORE_LINE, + SEA_SURFACE } diff --git a/src/main/java/ninja/bytecode/iris/object/IrisBiomeDecorator.java b/src/main/java/ninja/bytecode/iris/object/IrisBiomeDecorator.java index 9887eb07e..216c89cdd 100644 --- a/src/main/java/ninja/bytecode/iris/object/IrisBiomeDecorator.java +++ b/src/main/java/ninja/bytecode/iris/object/IrisBiomeDecorator.java @@ -23,7 +23,7 @@ public class IrisBiomeDecorator @Desc("If this decorator has a height more than 1 this changes how it picks the height between your maxes. Scatter = random, Wispy = wavy heights") private Dispersion verticalVariance = Dispersion.SCATTER; - @Desc("Tells iris where this decoration is a part of. I.e. SHORE_LINE") + @Desc("Tells iris where this decoration is a part of. I.e. SHORE_LINE or SEA_SURFACE") private DecorationPart partOf = DecorationPart.NONE; @Desc("The minimum repeat stack height (setting to 3 would stack 3 of on top of each other") diff --git a/src/main/java/ninja/bytecode/iris/object/IrisObject.java b/src/main/java/ninja/bytecode/iris/object/IrisObject.java index feffafdf7..017fc8433 100644 --- a/src/main/java/ninja/bytecode/iris/object/IrisObject.java +++ b/src/main/java/ninja/bytecode/iris/object/IrisObject.java @@ -134,6 +134,11 @@ public class IrisObject extends IrisRegistrant int y = yv < 0 ? placer.getHighest(x, z, config.isUnderwater()) + config.getRotation().rotate(new BlockVector(0, getCenter().getBlockY(), 0), yf, xf, spinx, spiny, spinz).getBlockY() : yv; KMap heightmap = config.getSnow() > 0 ? new KMap<>() : null; + if(!config.isUnderwater() && !config.isOnwater() && placer.isUnderwater(x, z)) + { + return; + } + for(BlockVector g : blocks.k()) { BlockVector i = g.clone(); diff --git a/src/main/java/ninja/bytecode/iris/object/IrisObjectPlacement.java b/src/main/java/ninja/bytecode/iris/object/IrisObjectPlacement.java index 50253fceb..f8f88218e 100644 --- a/src/main/java/ninja/bytecode/iris/object/IrisObjectPlacement.java +++ b/src/main/java/ninja/bytecode/iris/object/IrisObjectPlacement.java @@ -33,6 +33,9 @@ public class IrisObjectPlacement @Desc("If set to true, objects will place on the terrain height, ignoring the water surface.") private boolean underwater = false; + @Desc("If set to true, objects will place on the fluid height level Such as boats.") + private boolean onwater = false; + @Desc("If set to true, this object will only place parts of itself where blocks already exist.") private boolean meld = false; diff --git a/src/main/java/ninja/bytecode/iris/util/IObjectPlacer.java b/src/main/java/ninja/bytecode/iris/util/IObjectPlacer.java index 93e68f1df..6cc0825b7 100644 --- a/src/main/java/ninja/bytecode/iris/util/IObjectPlacer.java +++ b/src/main/java/ninja/bytecode/iris/util/IObjectPlacer.java @@ -15,4 +15,6 @@ public interface IObjectPlacer public boolean isPreventingDecay(); public boolean isSolid(int x, int y, int z); + + public boolean isUnderwater(int x, int z); }