From b4fa63545521487f59cfc24190cadb0022ce8e82 Mon Sep 17 00:00:00 2001 From: Astrash Date: Wed, 9 Oct 2024 20:45:25 +1100 Subject: [PATCH] Ensure throw with incorrect use of SimplexStyle derivatives This should ensure that in the case an implementation fails to correctly check isDifferentiable then performs a subsequent derivative based sample, an error is thrown, rather than potentially missing a logic bug due to noise of 0 and derivative of 0 being returned which could otherwise be hard to narrow down. --- .../noise/samplers/noise/simplex/SimplexStyleSampler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/SimplexStyleSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/SimplexStyleSampler.java index f9c3f65a7..9b646830b 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/SimplexStyleSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/SimplexStyleSampler.java @@ -116,12 +116,12 @@ public abstract class SimplexStyleSampler extends DerivativeNoiseFunction { @Override public double[] getNoiseDerivativeRaw(long seed, double x, double y) { - return new double[]{ 0, 0, 0 }; + throw new UnsupportedOperationException("Implementation failed to check or set isDifferentiable correctly"); } @Override public double[] getNoiseDerivativeRaw(long seed, double x, double y, double z) { - return new double[]{ 0, 0, 0, 0 }; + throw new UnsupportedOperationException("Implementation failed to check or set isDifferentiable correctly"); } @Override