From d4c0e07b1daf62c526eb1140dce429d1d0939721 Mon Sep 17 00:00:00 2001 From: Sjoerd van de Goor Date: Wed, 8 Feb 2023 01:29:30 +0100 Subject: [PATCH] Slope condition --- .../java/com/volmit/iris/engine/object/IrisObject.java | 7 +++++++ .../com/volmit/iris/engine/object/IrisObjectPlacement.java | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/volmit/iris/engine/object/IrisObject.java b/src/main/java/com/volmit/iris/engine/object/IrisObject.java index a503bb11a..8569ba2c7 100644 --- a/src/main/java/com/volmit/iris/engine/object/IrisObject.java +++ b/src/main/java/com/volmit/iris/engine/object/IrisObject.java @@ -496,6 +496,13 @@ public class IrisObject extends IrisRegistrant { public int place(int x, int yv, int z, IObjectPlacer oplacer, IrisObjectPlacement config, RNG rng, BiConsumer listener, CarveResult c, IrisData rdata) { IObjectPlacer placer = (config.getHeightmap() != null) ? new HeightmapObjectPlacer(oplacer.getEngine() == null ? IrisContext.get().getEngine() : oplacer.getEngine(), rng, x, yv, z, config, oplacer) : oplacer; + // Slope calculation + if (!config.getSlopeCondition().isDefault() && + !config.getSlopeCondition().isValid(rdata.getEngine().getComplex().getSlopeStream().get(x, z))) + { + return -1; + } + if (config.isSmartBore()) { ensureSmartBored(placer.isDebugSmartBore()); } diff --git a/src/main/java/com/volmit/iris/engine/object/IrisObjectPlacement.java b/src/main/java/com/volmit/iris/engine/object/IrisObjectPlacement.java index b39c076b9..7b7a08562 100644 --- a/src/main/java/com/volmit/iris/engine/object/IrisObjectPlacement.java +++ b/src/main/java/com/volmit/iris/engine/object/IrisObjectPlacement.java @@ -62,6 +62,8 @@ public class IrisObjectPlacement { private double snow = 0; @Desc("Whether or not this object can be targeted by a dolphin.") private boolean isDolphinTarget = false; + @Desc("The slope at which this object can be placed. Range from 0 to 10 by default. Calculated from the corners of the object.") + private IrisSlopeClip slopeCondition = new IrisSlopeClip(); @MinNumber(0) @MaxNumber(1) @Desc("The chance for this to place in a chunk. If you need multiple per chunk, set this to 1 and use density.")