From 866d527d35de75a106e12a2fd302e7083a52ab9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB=20Gidiere?= Date: Fri, 17 Nov 2023 13:11:28 -0700 Subject: [PATCH 01/56] bump version --- build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 73654719d..a8a497a85 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,8 +1,8 @@ preRelease(true) -versionProjects(":common:api", version("6.4.0")) -versionProjects(":common:implementation", version("6.4.0")) -versionProjects(":platforms", version("6.4.0")) +versionProjects(":common:api", version("6.5.0")) +versionProjects(":common:implementation", version("6.5.0")) +versionProjects(":platforms", version("6.5.0")) allprojects { From 271e7f3c693244825c3dd92358e097624c64daa8 Mon Sep 17 00:00:00 2001 From: Astrash Date: Fri, 5 Jan 2024 18:42:35 +1100 Subject: [PATCH 02/56] Fix empty slant holders attempting to calculate slant This occurs when the NoiseChunkGenerator3D#getSlant method is invoked at a position where the biome has an empty slant holder, currently possible when using the slant locator addon. This is fixed by making slant calculation independent of SlantHolders. Some minor refactoring has also been done as a result of this change. --- .../NoiseChunkGenerator3DAddon.java | 7 +- ...NoiseChunkGeneratorPackConfigTemplate.java | 6 +- .../config/palette/BiomePaletteTemplate.java | 5 +- .../generation/NoiseChunkGenerator3D.java | 33 +++++--- .../generation/math/PaletteUtil.java | 29 ------- .../math/SlantCalculationMethod.java | 69 +++++++++++++++++ .../palette/slant/MultipleSlantHolder.java | 3 +- .../palette/slant/SingleSlantHolder.java | 3 +- .../palette/slant/SlantHolder.java | 77 +------------------ .../palette/slant/SlantHolderImpl.java | 11 +-- 10 files changed, 110 insertions(+), 133 deletions(-) delete mode 100644 common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/PaletteUtil.java create mode 100644 common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/SlantCalculationMethod.java diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/NoiseChunkGenerator3DAddon.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/NoiseChunkGenerator3DAddon.java index 89f6e038c..ca2d8bc69 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/NoiseChunkGenerator3DAddon.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/NoiseChunkGenerator3DAddon.java @@ -13,6 +13,7 @@ import com.dfsek.terra.addons.chunkgenerator.config.palette.BiomePaletteTemplate; import com.dfsek.terra.addons.chunkgenerator.config.palette.slant.SlantLayerTemplate; import com.dfsek.terra.addons.chunkgenerator.generation.NoiseChunkGenerator3D; +import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod; import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo; import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder; import com.dfsek.terra.addons.manifest.api.AddonInitializer; @@ -45,8 +46,8 @@ public void initialize() { .priority(1000) .then(event -> { - event.getPack().applyLoader(SlantHolder.CalculationMethod.class, - (type, o, loader, depthTracker) -> SlantHolder.CalculationMethod.valueOf((String) o)); + event.getPack().applyLoader(SlantCalculationMethod.class, + (type, o, loader, depthTracker) -> SlantCalculationMethod.valueOf((String) o)); NoiseChunkGeneratorPackConfigTemplate config = event.loadTemplate(new NoiseChunkGeneratorPackConfigTemplate()); event.getPack().getContext().put(config); @@ -57,7 +58,7 @@ public void initialize() { pack -> new NoiseChunkGenerator3D(pack, platform, config.getElevationBlend(), config.getHorizontalRes(), config.getVerticalRes(), noisePropertiesPropertyKey, - paletteInfoPropertyKey)); + paletteInfoPropertyKey, config.getSlantCalculationMethod())); event.getPack() .applyLoader(SlantHolder.Layer.class, SlantLayerTemplate::new); }) diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/NoiseChunkGeneratorPackConfigTemplate.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/NoiseChunkGeneratorPackConfigTemplate.java index c3828bbbf..b1f32c68a 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/NoiseChunkGeneratorPackConfigTemplate.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/NoiseChunkGeneratorPackConfigTemplate.java @@ -4,7 +4,7 @@ import com.dfsek.tectonic.api.config.template.annotations.Default; import com.dfsek.tectonic.api.config.template.annotations.Value; -import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder; +import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod; import com.dfsek.terra.api.config.meta.Meta; import com.dfsek.terra.api.properties.Properties; @@ -24,7 +24,7 @@ public class NoiseChunkGeneratorPackConfigTemplate implements ConfigTemplate, Pr @Value("slant.calculation-method") @Default - private SlantHolder.@Meta CalculationMethod slantCalculationMethod = SlantHolder.CalculationMethod.Derivative; + private @Meta SlantCalculationMethod slantCalculationMethod = SlantCalculationMethod.Derivative; public int getElevationBlend() { return elevationBlend; @@ -38,7 +38,7 @@ public int getVerticalRes() { return verticalRes; } - public SlantHolder.CalculationMethod getSlantCalculationMethod() { + public SlantCalculationMethod getSlantCalculationMethod() { return slantCalculationMethod; } } diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/palette/BiomePaletteTemplate.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/palette/BiomePaletteTemplate.java index 2d479f1a2..a4ff986e4 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/palette/BiomePaletteTemplate.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/palette/BiomePaletteTemplate.java @@ -16,6 +16,7 @@ import java.util.List; import java.util.Map; +import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod; import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo; import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder; import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder; @@ -27,7 +28,7 @@ public class BiomePaletteTemplate implements ObjectTemplate { private final Platform platform; - private final SlantHolder.CalculationMethod slantCalculationMethod; + private final SlantCalculationMethod slantCalculationMethod; @Value("slant") @Default @Description("The slant palettes to use in this biome.") @@ -56,7 +57,7 @@ public BlockState get(int layer, double x, double y, double z, long seed) { @Default private @Meta boolean updatePalette = false; - public BiomePaletteTemplate(Platform platform, SlantHolder.CalculationMethod slantCalculationMethod) { + public BiomePaletteTemplate(Platform platform, SlantCalculationMethod slantCalculationMethod) { this.platform = platform; this.slantCalculationMethod = slantCalculationMethod; } diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/NoiseChunkGenerator3D.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/NoiseChunkGenerator3D.java index 08dc93cbe..13cf69ace 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/NoiseChunkGenerator3D.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/NoiseChunkGenerator3D.java @@ -8,10 +8,13 @@ package com.dfsek.terra.addons.chunkgenerator.generation; +import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder; + +import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod; + import org.jetbrains.annotations.NotNull; import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties; -import com.dfsek.terra.addons.chunkgenerator.generation.math.PaletteUtil; import com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation.LazilyEvaluatedInterpolator; import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D; import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.SamplerProvider; @@ -42,16 +45,19 @@ public class NoiseChunkGenerator3D implements ChunkGenerator { private final PropertyKey paletteInfoPropertyKey; private final PropertyKey noisePropertiesKey; + private final SlantCalculationMethod slantCalculationMethod; + public NoiseChunkGenerator3D(ConfigPack pack, Platform platform, int elevationBlend, int carverHorizontalResolution, int carverVerticalResolution, PropertyKey noisePropertiesKey, - PropertyKey paletteInfoPropertyKey) { + PropertyKey paletteInfoPropertyKey, SlantCalculationMethod slantCalculationMethod) { this.platform = platform; this.air = platform.getWorldHandle().air(); this.carverHorizontalResolution = carverHorizontalResolution; this.carverVerticalResolution = carverVerticalResolution; this.paletteInfoPropertyKey = paletteInfoPropertyKey; this.noisePropertiesKey = noisePropertiesKey; + this.slantCalculationMethod = slantCalculationMethod; int maxBlend = pack .getBiomeProvider() .stream() @@ -63,6 +69,17 @@ public NoiseChunkGenerator3D(ConfigPack pack, Platform platform, int elevationBl this.samplerCache = new SamplerProvider(platform, elevationBlend, noisePropertiesKey, maxBlend); } + private Palette paletteAt(int x, int y, int z, Sampler3D sampler, BiomePaletteInfo paletteInfo, int depth) { + SlantHolder slantHolder = paletteInfo.slantHolder(); + if(slantHolder.isAboveDepth(depth)) { + double slant = slantCalculationMethod.slant(sampler, x, y, z); + if(slantHolder.isInSlantThreshold(slant)) { + return slantHolder.getPalette(slant).getPalette(y); + } + } + return paletteInfo.paletteHolder().getPalette(y); + } + @Override @SuppressWarnings("try") public void generateChunkData(@NotNull ProtoChunk chunk, @NotNull WorldProperties world, @@ -103,8 +120,7 @@ public void generateChunkData(@NotNull ProtoChunk chunk, @NotNull WorldPropertie if(sampler.sample(x, y, z) > 0) { if(carver.sample(x, y, z) <= 0) { - data = PaletteUtil - .getPalette(x, y, z, sampler, paletteInfo, paletteLevel) + data = paletteAt(x, y, z, sampler, paletteInfo, paletteLevel) .get(paletteLevel, cx, y, cz, seed); chunk.setBlock(x, y, z, data); paletteLevel++; @@ -135,7 +151,7 @@ public BlockState getBlock(WorldProperties world, int x, int y, int z, BiomeProv int fdX = Math.floorMod(x, 16); int fdZ = Math.floorMod(z, 16); - Palette palette = PaletteUtil.getPalette(fdX, y, fdZ, sampler, paletteInfo, 0); + Palette palette = paletteAt(fdX, y, fdZ, sampler, paletteInfo, 0); double noise = sampler.sample(fdX, y, fdZ); if(noise > 0) { int level = 0; @@ -157,11 +173,8 @@ public Palette getPalette(int x, int y, int z, WorldProperties world, BiomeProvi public double getSlant(int x, int y, int z, WorldProperties world, BiomeProvider biomeProvider) { int fdX = Math.floorMod(x, 16); int fdZ = Math.floorMod(z, 16); - return biomeProvider.getBiome(x, y, z, world.getSeed()) - .getContext() - .get(paletteInfoPropertyKey) - .slantHolder() - .calculateSlant(samplerCache.get(x, z, world, biomeProvider), fdX, y, fdZ); + Sampler3D sampler = samplerCache.get(x, z, world, biomeProvider); + return slantCalculationMethod.slant(sampler, fdX, y, fdZ); } public SamplerProvider samplerProvider() { diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/PaletteUtil.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/PaletteUtil.java deleted file mode 100644 index e7c20784c..000000000 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/PaletteUtil.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2020-2023 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.chunkgenerator.generation.math; - -import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D; -import com.dfsek.terra.addons.chunkgenerator.palette.BiomePaletteInfo; -import com.dfsek.terra.addons.chunkgenerator.palette.slant.SlantHolder; -import com.dfsek.terra.api.world.chunk.generation.util.Palette; - - -public final class PaletteUtil { - - public static Palette getPalette(int x, int y, int z, Sampler3D sampler, BiomePaletteInfo paletteInfo, int depth) { - SlantHolder slantHolder = paletteInfo.slantHolder(); - if(slantHolder.isAboveDepth(depth)) { - double slant = slantHolder.calculateSlant(sampler, x, y, z); - if(slantHolder.isInSlantThreshold(slant)) { - return slantHolder.getPalette(slant).getPalette(y); - } - } - - return paletteInfo.paletteHolder().getPalette(y); - } -} \ No newline at end of file diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/SlantCalculationMethod.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/SlantCalculationMethod.java new file mode 100644 index 000000000..1c03a038a --- /dev/null +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/SlantCalculationMethod.java @@ -0,0 +1,69 @@ +package com.dfsek.terra.addons.chunkgenerator.generation.math; + +import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D; +import com.dfsek.terra.api.util.vector.Vector3; + + +public enum SlantCalculationMethod { + DotProduct { + private static final Vector3 DOT_PRODUCT_DIRECTION = Vector3.of(0, 1, 0); + + private static final Vector3[] DOT_PRODUCT_SAMPLE_POINTS = { + Vector3.of(0, 0, -DERIVATIVE_DIST), + Vector3.of(0, 0, DERIVATIVE_DIST), + Vector3.of(0, -DERIVATIVE_DIST, 0), + Vector3.of(0, DERIVATIVE_DIST, 0), + Vector3.of(-DERIVATIVE_DIST, 0, 0), + Vector3.of(DERIVATIVE_DIST, 0, 0) + }; + + @Override + public double slant(Sampler3D sampler, double x, double y, double z) { + Vector3.Mutable normalApproximation = Vector3.Mutable.of(0, 0, 0); + for(Vector3 point : DOT_PRODUCT_SAMPLE_POINTS) { + var scalar = -sampler.sample(x + point.getX(), y + point.getY(), z + point.getZ()); + normalApproximation.add(point.mutable().multiply(scalar)); + } + return DOT_PRODUCT_DIRECTION.dot(normalApproximation.normalize()); + } + + @Override + public boolean floorToThreshold() { + return false; + } + }, + + Derivative { + @Override + public double slant(Sampler3D sampler, double x, double y, double z) { + double baseSample = sampler.sample(x, y, z); + + double xVal1 = (sampler.sample(x + DERIVATIVE_DIST, y, z) - baseSample) / DERIVATIVE_DIST; + double xVal2 = (sampler.sample(x - DERIVATIVE_DIST, y, z) - baseSample) / DERIVATIVE_DIST; + double zVal1 = (sampler.sample(x, y, z + DERIVATIVE_DIST) - baseSample) / DERIVATIVE_DIST; + double zVal2 = (sampler.sample(x, y, z - DERIVATIVE_DIST) - baseSample) / DERIVATIVE_DIST; + double yVal1 = (sampler.sample(x, y + DERIVATIVE_DIST, z) - baseSample) / DERIVATIVE_DIST; + double yVal2 = (sampler.sample(x, y - DERIVATIVE_DIST, z) - baseSample) / DERIVATIVE_DIST; + + return Math.sqrt( + ((xVal2 - xVal1) * (xVal2 - xVal1)) + ((zVal2 - zVal1) * (zVal2 - zVal1)) + ((yVal2 - yVal1) * (yVal2 - yVal1))); + } + + @Override + public boolean floorToThreshold() { + return true; + } + }; + + private static final double DERIVATIVE_DIST = 0.55; + + public abstract double slant(Sampler3D sampler, double x, double y, double z); + + /* + * Controls whether palettes should be applied before or after their respective thresholds. + * + * If true, slant values will map to the palette of the next floor threshold, otherwise they + * will map to the ceiling. + */ + public abstract boolean floorToThreshold(); +} diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/MultipleSlantHolder.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/MultipleSlantHolder.java index 895c02698..08f1d16fe 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/MultipleSlantHolder.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/MultipleSlantHolder.java @@ -14,6 +14,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod; import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder; @@ -21,7 +22,7 @@ public class MultipleSlantHolder extends SlantHolderImpl { private final NavigableMap layers; private final double slantThreshold; - MultipleSlantHolder(List slant, int slantDepth, CalculationMethod calculationMethod) { + MultipleSlantHolder(List slant, int slantDepth, SlantCalculationMethod calculationMethod) { super(slantDepth, calculationMethod); NavigableMap layers = new TreeMap<>( slant.stream().collect(Collectors.toMap(SlantHolder.Layer::threshold, SlantHolder.Layer::palette))); diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SingleSlantHolder.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SingleSlantHolder.java index 12f29ef18..3f8ab5408 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SingleSlantHolder.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SingleSlantHolder.java @@ -1,5 +1,6 @@ package com.dfsek.terra.addons.chunkgenerator.palette.slant; +import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod; import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder; @@ -7,7 +8,7 @@ final class SingleSlantHolder extends SlantHolderImpl { private final SlantHolder.Layer layer; - public SingleSlantHolder(SlantHolder.Layer layer, int slantDepth, CalculationMethod calculationMethod) { + public SingleSlantHolder(SlantHolder.Layer layer, int slantDepth, SlantCalculationMethod calculationMethod) { super(slantDepth, calculationMethod); this.layer = layer; } diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SlantHolder.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SlantHolder.java index 359913d41..d4c2855cd 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SlantHolder.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SlantHolder.java @@ -2,19 +2,13 @@ import java.util.List; -import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D; +import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod; import com.dfsek.terra.addons.chunkgenerator.palette.PaletteHolder; -import com.dfsek.terra.api.util.vector.Vector3; public interface SlantHolder { SlantHolder EMPTY = new SlantHolder() { - @Override - public double calculateSlant(Sampler3D sampler, double x, double y, double z) { - throw new UnsupportedOperationException("Empty holder should not calculate slant"); - } - @Override public boolean isAboveDepth(int depth) { return false; @@ -31,7 +25,7 @@ public PaletteHolder getPalette(double slant) { } }; - static SlantHolder of(List layers, int slantDepth, CalculationMethod calculationMethod) { + static SlantHolder of(List layers, int slantDepth, SlantCalculationMethod calculationMethod) { if(layers.isEmpty()) { return EMPTY; } else if(layers.size() == 1) { @@ -40,8 +34,6 @@ static SlantHolder of(List layers, int slantDepth, Calculatio return new MultipleSlantHolder(layers, slantDepth, calculationMethod); } - double calculateSlant(Sampler3D sampler, double x, double y, double z); - boolean isAboveDepth(int depth); boolean isInSlantThreshold(double slant); @@ -49,71 +41,6 @@ static SlantHolder of(List layers, int slantDepth, Calculatio PaletteHolder getPalette(double slant); - enum CalculationMethod { - DotProduct { - private static final Vector3 DOT_PRODUCT_DIRECTION = Vector3.of(0, 1, 0); - - private static final Vector3[] DOT_PRODUCT_SAMPLE_POINTS = { - Vector3.of(0, 0, -DERIVATIVE_DIST), - Vector3.of(0, 0, DERIVATIVE_DIST), - Vector3.of(0, -DERIVATIVE_DIST, 0), - Vector3.of(0, DERIVATIVE_DIST, 0), - Vector3.of(-DERIVATIVE_DIST, 0, 0), - Vector3.of(DERIVATIVE_DIST, 0, 0) - }; - - @Override - public double slant(Sampler3D sampler, double x, double y, double z) { - Vector3.Mutable normalApproximation = Vector3.Mutable.of(0, 0, 0); - for(Vector3 point : DOT_PRODUCT_SAMPLE_POINTS) { - var scalar = -sampler.sample(x + point.getX(), y + point.getY(), z + point.getZ()); - normalApproximation.add(point.mutable().multiply(scalar)); - } - return DOT_PRODUCT_DIRECTION.dot(normalApproximation.normalize()); - } - - @Override - public boolean floorToThreshold() { - return false; - } - }, - - Derivative { - @Override - public double slant(Sampler3D sampler, double x, double y, double z) { - double baseSample = sampler.sample(x, y, z); - - double xVal1 = (sampler.sample(x + DERIVATIVE_DIST, y, z) - baseSample) / DERIVATIVE_DIST; - double xVal2 = (sampler.sample(x - DERIVATIVE_DIST, y, z) - baseSample) / DERIVATIVE_DIST; - double zVal1 = (sampler.sample(x, y, z + DERIVATIVE_DIST) - baseSample) / DERIVATIVE_DIST; - double zVal2 = (sampler.sample(x, y, z - DERIVATIVE_DIST) - baseSample) / DERIVATIVE_DIST; - double yVal1 = (sampler.sample(x, y + DERIVATIVE_DIST, z) - baseSample) / DERIVATIVE_DIST; - double yVal2 = (sampler.sample(x, y - DERIVATIVE_DIST, z) - baseSample) / DERIVATIVE_DIST; - - return Math.sqrt( - ((xVal2 - xVal1) * (xVal2 - xVal1)) + ((zVal2 - zVal1) * (zVal2 - zVal1)) + ((yVal2 - yVal1) * (yVal2 - yVal1))); - } - - @Override - public boolean floorToThreshold() { - return true; - } - }; - - private static final double DERIVATIVE_DIST = 0.55; - - public abstract double slant(Sampler3D sampler, double x, double y, double z); - - /* - * Controls whether palettes should be applied before or after their respective thresholds. - * - * If true, slant values will map to the palette of the next floor threshold, otherwise they - * will map to the ceiling. - */ - public abstract boolean floorToThreshold(); - } - - record Layer(PaletteHolder palette, double threshold) { } } diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SlantHolderImpl.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SlantHolderImpl.java index 13fc68ef1..bef21cdba 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SlantHolderImpl.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/palette/slant/SlantHolderImpl.java @@ -1,26 +1,19 @@ package com.dfsek.terra.addons.chunkgenerator.palette.slant; -import com.dfsek.terra.addons.chunkgenerator.generation.math.samplers.Sampler3D; +import com.dfsek.terra.addons.chunkgenerator.generation.math.SlantCalculationMethod; public abstract class SlantHolderImpl implements SlantHolder { protected final boolean floorToThreshold; - private final SlantHolder.CalculationMethod calculationMethod; private final int slantDepth; - protected SlantHolderImpl(int slantDepth, CalculationMethod calculationMethod) { + protected SlantHolderImpl(int slantDepth, SlantCalculationMethod calculationMethod) { this.floorToThreshold = calculationMethod.floorToThreshold(); - this.calculationMethod = calculationMethod; this.slantDepth = slantDepth; } protected abstract double getSlantThreshold(); - @Override - public final double calculateSlant(Sampler3D sampler, double x, double y, double z) { - return calculationMethod.slant(sampler, x, y, z); - } - @Override public final boolean isAboveDepth(int depth) { return depth <= slantDepth; From 9c181f7ee123bdf60cfecc3a8472b3359cf396a7 Mon Sep 17 00:00:00 2001 From: Astrash Date: Sat, 6 Jan 2024 09:13:02 +1100 Subject: [PATCH 03/56] Add ability to disable slant palettes globally --- .../addons/chunkgenerator/NoiseChunkGenerator3DAddon.java | 3 ++- .../config/NoiseChunkGeneratorPackConfigTemplate.java | 8 ++++++++ .../chunkgenerator/generation/NoiseChunkGenerator3D.java | 8 ++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/NoiseChunkGenerator3DAddon.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/NoiseChunkGenerator3DAddon.java index ca2d8bc69..f2f0c9386 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/NoiseChunkGenerator3DAddon.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/NoiseChunkGenerator3DAddon.java @@ -58,7 +58,8 @@ public void initialize() { pack -> new NoiseChunkGenerator3D(pack, platform, config.getElevationBlend(), config.getHorizontalRes(), config.getVerticalRes(), noisePropertiesPropertyKey, - paletteInfoPropertyKey, config.getSlantCalculationMethod())); + paletteInfoPropertyKey, config.getSlantCalculationMethod(), + config.isSlantPalettesEnabled())); event.getPack() .applyLoader(SlantHolder.Layer.class, SlantLayerTemplate::new); }) diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/NoiseChunkGeneratorPackConfigTemplate.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/NoiseChunkGeneratorPackConfigTemplate.java index b1f32c68a..ae1f1ca4a 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/NoiseChunkGeneratorPackConfigTemplate.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/config/NoiseChunkGeneratorPackConfigTemplate.java @@ -26,6 +26,10 @@ public class NoiseChunkGeneratorPackConfigTemplate implements ConfigTemplate, Pr @Default private @Meta SlantCalculationMethod slantCalculationMethod = SlantCalculationMethod.Derivative; + @Value("slant.disable-palettes") + @Default + private @Meta boolean disableSlantPalettes = false; + public int getElevationBlend() { return elevationBlend; } @@ -41,4 +45,8 @@ public int getVerticalRes() { public SlantCalculationMethod getSlantCalculationMethod() { return slantCalculationMethod; } + + public boolean isSlantPalettesEnabled() { + return !disableSlantPalettes; + } } diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/NoiseChunkGenerator3D.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/NoiseChunkGenerator3D.java index 13cf69ace..95c2891cc 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/NoiseChunkGenerator3D.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/NoiseChunkGenerator3D.java @@ -47,10 +47,13 @@ public class NoiseChunkGenerator3D implements ChunkGenerator { private final SlantCalculationMethod slantCalculationMethod; + private final boolean useSlantPalettes; + public NoiseChunkGenerator3D(ConfigPack pack, Platform platform, int elevationBlend, int carverHorizontalResolution, int carverVerticalResolution, PropertyKey noisePropertiesKey, - PropertyKey paletteInfoPropertyKey, SlantCalculationMethod slantCalculationMethod) { + PropertyKey paletteInfoPropertyKey, + SlantCalculationMethod slantCalculationMethod, boolean useSlantPalettes) { this.platform = platform; this.air = platform.getWorldHandle().air(); this.carverHorizontalResolution = carverHorizontalResolution; @@ -58,6 +61,7 @@ public NoiseChunkGenerator3D(ConfigPack pack, Platform platform, int elevationBl this.paletteInfoPropertyKey = paletteInfoPropertyKey; this.noisePropertiesKey = noisePropertiesKey; this.slantCalculationMethod = slantCalculationMethod; + this.useSlantPalettes = useSlantPalettes; int maxBlend = pack .getBiomeProvider() .stream() @@ -71,7 +75,7 @@ public NoiseChunkGenerator3D(ConfigPack pack, Platform platform, int elevationBl private Palette paletteAt(int x, int y, int z, Sampler3D sampler, BiomePaletteInfo paletteInfo, int depth) { SlantHolder slantHolder = paletteInfo.slantHolder(); - if(slantHolder.isAboveDepth(depth)) { + if(useSlantPalettes && slantHolder.isAboveDepth(depth)) { double slant = slantCalculationMethod.slant(sampler, x, y, z); if(slantHolder.isInSlantThreshold(slant)) { return slantHolder.getPalette(slant).getPalette(y); From f3476c5cc8ca220d976686778bcf0a598582dcd7 Mon Sep 17 00:00:00 2001 From: Astrash Date: Sun, 7 Jan 2024 17:02:08 +1100 Subject: [PATCH 04/56] Add feature stage blending --- .../feature/FeatureGenerationStage.java | 15 +++++++++++-- .../feature/config/FeatureStageTemplate.java | 21 ++++++++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java index 6baf88b7a..123107d15 100644 --- a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java +++ b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java @@ -12,6 +12,7 @@ import com.dfsek.terra.addons.generation.feature.config.BiomeFeatures; import com.dfsek.terra.api.Platform; +import com.dfsek.terra.api.noise.NoiseSampler; import com.dfsek.terra.api.properties.PropertyKey; import com.dfsek.terra.api.registry.key.StringIdentifiable; import com.dfsek.terra.api.util.Rotation; @@ -31,13 +32,20 @@ public class FeatureGenerationStage implements GenerationStage, StringIdentifiab private final int resolution; private final PropertyKey biomeFeaturesKey; + private final NoiseSampler blendSampler; + private final boolean doBlending; + private final double blendAmplitude; - public FeatureGenerationStage(Platform platform, String id, int resolution, PropertyKey biomeFeaturesKey) { + public FeatureGenerationStage(Platform platform, String id, int resolution, PropertyKey biomeFeaturesKey, + NoiseSampler blendSampler, double blendAmplitude) { this.platform = platform; this.id = id; this.profile = "feature_stage:" + id; this.resolution = resolution; this.biomeFeaturesKey = biomeFeaturesKey; + this.blendSampler = blendSampler; + this.doBlending = blendAmplitude != 0d; + this.blendAmplitude = blendAmplitude; } @Override @@ -52,7 +60,10 @@ public void populate(ProtoWorld world) { int tx = cx + chunkX; int tz = cz + chunkZ; world.getBiomeProvider() - .getColumn(tx, tz, world) + .getColumn( + tx + (doBlending ? (int) (blendSampler.noise(seed, tx, tz) * blendAmplitude) : 0), + tz + (doBlending ? (int) (blendSampler.noise(seed+1, tx, tz) * blendAmplitude) : 0), + world) .forRanges(resolution, (min, max, biome) -> { for(int subChunkX = 0; subChunkX < resolution; subChunkX++) { for(int subChunkZ = 0; subChunkZ < resolution; subChunkZ++) { diff --git a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/config/FeatureStageTemplate.java b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/config/FeatureStageTemplate.java index ffc077f1a..d0fae0e1f 100644 --- a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/config/FeatureStageTemplate.java +++ b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/config/FeatureStageTemplate.java @@ -8,6 +8,7 @@ import com.dfsek.terra.addons.generation.feature.FeatureGenerationStage; import com.dfsek.terra.api.Platform; +import com.dfsek.terra.api.noise.NoiseSampler; import com.dfsek.terra.api.properties.PropertyKey; import com.dfsek.terra.api.world.chunk.generation.stage.GenerationStage; @@ -22,6 +23,24 @@ public class FeatureStageTemplate implements ObjectTemplate, Va @Default private int resolution = 4; + @Value("blend.sampler") + @Default + private NoiseSampler blendSampler = new NoiseSampler() { + @Override + public double noise(long seed, double x, double y) { + return 0; + } + + @Override + public double noise(long seed, double x, double y, double z) { + return 0; + } + }; + + @Value("blend.amplitude") + @Default + private double blendAmplitude = 0d; + public FeatureStageTemplate(Platform platform, PropertyKey biomeFeaturesKey) { this.platform = platform; this.biomeFeaturesKey = biomeFeaturesKey; @@ -30,7 +49,7 @@ public FeatureStageTemplate(Platform platform, PropertyKey biomeF @Override public FeatureGenerationStage get() { - return new FeatureGenerationStage(platform, id, resolution, biomeFeaturesKey); + return new FeatureGenerationStage(platform, id, resolution, biomeFeaturesKey, blendSampler, blendAmplitude); } @Override From c52ad56cccb4590726f3fb744b94153983e68c2a Mon Sep 17 00:00:00 2001 From: Browsit <80560008+Browsit@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:15:37 -0500 Subject: [PATCH 05/56] Return null for empty generator IDs --- .../src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java | 1 + 1 file changed, 1 insertion(+) diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java index a8701da17..555d073c7 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java @@ -189,6 +189,7 @@ private boolean doVersionCheck() { @Override public @Nullable ChunkGenerator getDefaultWorldGenerator(@NotNull String worldName, String id) { + if (id == null || id.trim().equals("")) { return null; } return new BukkitChunkGeneratorWrapper(generatorMap.computeIfAbsent(worldName, name -> { ConfigPack pack = platform.getConfigRegistry().getByID(id).orElseThrow( () -> new IllegalArgumentException("No such config pack \"" + id + "\"")); From 01e011a9edec3884bade363b03394a72922b41c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB=20Gidiere?= Date: Fri, 5 Jan 2024 14:46:01 -0700 Subject: [PATCH 06/56] UX tweaks to biome config --- .../java/com/dfsek/terra/mod/ModPlatform.java | 53 +++++++++---------- .../terra/mod/config/SpawnGroupTemplate.java | 18 ------- .../mod/config/SpawnSettingsTemplate.java | 7 ++- .../terra/mod/config/SpawnTypeConfig.java | 14 ++--- 4 files changed, 40 insertions(+), 52 deletions(-) delete mode 100644 platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnGroupTemplate.java diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java index 25c78c228..d6d35508a 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java @@ -44,7 +44,6 @@ import com.dfsek.terra.mod.config.SoundEventTemplate; import com.dfsek.terra.mod.config.SpawnCostConfig; import com.dfsek.terra.mod.config.SpawnEntryTemplate; -import com.dfsek.terra.mod.config.SpawnGroupTemplate; import com.dfsek.terra.mod.config.SpawnSettingsTemplate; import com.dfsek.terra.mod.config.SpawnTypeConfig; import com.dfsek.terra.mod.config.VillagerTypeTemplate; @@ -68,32 +67,32 @@ public void registerWorldTypes(BiConsumer registerFunct public void register(TypeRegistry registry) { super.register(registry); registry.registerLoader(PlatformBiome.class, (type, o, loader, depthTracker) -> parseBiome((String) o, depthTracker)) - .registerLoader(Identifier.class, (type, o, loader, depthTracker) -> { - Identifier identifier = Identifier.tryParse((String) o); - if(identifier == null) - throw new LoadException("Invalid identifier: " + o, depthTracker); - return identifier; - }) - .registerLoader(Precipitation.class, (type, o, loader, depthTracker) -> Precipitation.valueOf(((String) o).toUpperCase( - Locale.ROOT))) - .registerLoader(GrassColorModifier.class, - (type, o, loader, depthTracker) -> GrassColorModifier.valueOf(((String) o).toUpperCase( - Locale.ROOT))) - .registerLoader(GrassColorModifier.class, - (type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase( - Locale.ROOT))) - .registerLoader(BiomeParticleConfig.class, BiomeParticleConfigTemplate::new) - .registerLoader(SoundEvent.class, SoundEventTemplate::new) - .registerLoader(BiomeMoodSound.class, BiomeMoodSoundTemplate::new) - .registerLoader(BiomeAdditionsSound.class, BiomeAdditionsSoundTemplate::new) - .registerLoader(MusicSound.class, MusicSoundTemplate::new) - .registerLoader(EntityType.class, EntityTypeTemplate::new) - .registerLoader(SpawnCostConfig.class, SpawnCostConfig::new) - .registerLoader(SpawnEntry.class, SpawnEntryTemplate::new) - .registerLoader(SpawnGroup.class, SpawnGroupTemplate::new) - .registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new) - .registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new) - .registerLoader(VillagerType.class, VillagerTypeTemplate::new); + .registerLoader(Identifier.class, (type, o, loader, depthTracker) -> { + Identifier identifier = Identifier.tryParse((String) o); + if(identifier == null) + throw new LoadException("Invalid identifier: " + o, depthTracker); + return identifier; + }) + .registerLoader(Precipitation.class, (type, o, loader, depthTracker) -> Precipitation.valueOf(((String) o).toUpperCase( + Locale.ROOT))) + .registerLoader(GrassColorModifier.class, + (type, o, loader, depthTracker) -> GrassColorModifier.valueOf(((String) o).toUpperCase( + Locale.ROOT))) + .registerLoader(GrassColorModifier.class, + (type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase( + Locale.ROOT))) + .registerLoader(SpawnGroup.class,(type, o, loader, depthTracker) -> SpawnGroup.valueOf((String) o)) + .registerLoader(BiomeParticleConfig.class, BiomeParticleConfigTemplate::new) + .registerLoader(SoundEvent.class, SoundEventTemplate::new) + .registerLoader(BiomeMoodSound.class, BiomeMoodSoundTemplate::new) + .registerLoader(BiomeAdditionsSound.class, BiomeAdditionsSoundTemplate::new) + .registerLoader(MusicSound.class, MusicSoundTemplate::new) + .registerLoader(EntityType.class, EntityTypeTemplate::new) + .registerLoader(SpawnCostConfig.class, SpawnCostConfig::new) + .registerLoader(SpawnEntry.class, SpawnEntryTemplate::new) + .registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new) + .registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new) + .registerLoader(VillagerType.class, VillagerTypeTemplate::new); } private ProtoPlatformBiome parseBiome(String id, DepthTracker tracker) throws LoadException { diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnGroupTemplate.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnGroupTemplate.java deleted file mode 100644 index 0ae2047f2..000000000 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnGroupTemplate.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.dfsek.terra.mod.config; - -import com.dfsek.tectonic.api.config.template.annotations.Default; -import com.dfsek.tectonic.api.config.template.annotations.Value; -import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; -import net.minecraft.entity.SpawnGroup; - - -public class SpawnGroupTemplate implements ObjectTemplate { - @Value("group") - @Default - private String group = null; - - @Override - public SpawnGroup get() { - return SpawnGroup.valueOf(group); - } -} diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnSettingsTemplate.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnSettingsTemplate.java index 9392e94e1..86e9de007 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnSettingsTemplate.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnSettingsTemplate.java @@ -3,7 +3,9 @@ import com.dfsek.tectonic.api.config.template.annotations.Default; import com.dfsek.tectonic.api.config.template.annotations.Value; import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; +import net.minecraft.entity.SpawnGroup; import net.minecraft.world.biome.SpawnSettings; +import net.minecraft.world.biome.SpawnSettings.SpawnEntry; import java.util.List; @@ -25,7 +27,10 @@ public class SpawnSettingsTemplate implements ObjectTemplate { public SpawnSettings get() { SpawnSettings.Builder builder = new SpawnSettings.Builder(); for(SpawnTypeConfig spawn : spawns) { - builder.spawn(spawn.getGroup(), spawn.getEntry()); + SpawnGroup group = spawn.getGroup(); + for (SpawnEntry entry : spawn.getEntry()) { + builder.spawn(group, entry); + } } for(SpawnCostConfig cost : costs) { builder.spawnCost(cost.getType(), cost.getMass(), cost.getGravity()); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnTypeConfig.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnTypeConfig.java index 9384f991d..b18c87e62 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnTypeConfig.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnTypeConfig.java @@ -6,21 +6,23 @@ import net.minecraft.entity.SpawnGroup; import net.minecraft.world.biome.SpawnSettings.SpawnEntry; +import java.util.List; + public class SpawnTypeConfig implements ObjectTemplate { @Value("group") @Default private SpawnGroup group = null; - - @Value("entry") + + @Value("entries") @Default - private SpawnEntry entry = null; - + private List entry = null; + public SpawnGroup getGroup() { return group; } - - public SpawnEntry getEntry() { + + public List getEntry() { return entry; } From 142d3646821f2c084deaa692dde96dcb2881f675 Mon Sep 17 00:00:00 2001 From: Astrash Date: Wed, 17 Apr 2024 09:54:07 +1000 Subject: [PATCH 07/56] WIP fractal-gavoro-pseudoerosion --- .../dfsek/terra/addons/noise/NoiseAddon.java | 10 +- .../DerivativeNoiseSamplerTemplate.java | 25 +++ .../noise/DerivativeFractalTemplate.java | 32 ++++ .../noise/PseudoErosionTemplate.java | 62 ++++++ .../noise/simplex/DerivativeFractal.java | 104 ++++++++++ .../samplers/noise/simplex/PseudoErosion.java | 179 ++++++++++++++++++ .../api/noise/DerivativeNoiseSampler.java | 22 +++ 7 files changed, 432 insertions(+), 2 deletions(-) create mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java create mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java create mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java create mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java create mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java create mode 100644 common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java index ca3aa1a44..53b5ef555 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java @@ -17,6 +17,7 @@ import com.dfsek.terra.addons.noise.config.CubicSplinePointTemplate; import com.dfsek.terra.addons.noise.config.DimensionApplicableNoiseSampler; import com.dfsek.terra.addons.noise.config.templates.BinaryArithmeticTemplate; +import com.dfsek.terra.addons.noise.config.templates.DerivativeNoiseSamplerTemplate; import com.dfsek.terra.addons.noise.config.templates.DomainWarpTemplate; import com.dfsek.terra.addons.noise.config.templates.FunctionTemplate; import com.dfsek.terra.addons.noise.config.templates.ImageSamplerTemplate; @@ -25,9 +26,11 @@ import com.dfsek.terra.addons.noise.config.templates.TranslateSamplerTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.CellularNoiseTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.ConstantNoiseTemplate; +import com.dfsek.terra.addons.noise.config.templates.noise.DerivativeFractalTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.DistanceSamplerTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.ExpressionFunctionTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.GaborNoiseTemplate; +import com.dfsek.terra.addons.noise.config.templates.noise.PseudoErosionTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.SimpleNoiseTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.fractal.BrownianMotionTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.fractal.PingPongTemplate; @@ -63,6 +66,7 @@ import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent; import com.dfsek.terra.api.event.functional.FunctionalEventHandler; import com.dfsek.terra.api.inject.annotations.Inject; +import com.dfsek.terra.api.noise.DerivativeNoiseSampler; import com.dfsek.terra.api.noise.NoiseSampler; import com.dfsek.terra.api.registry.CheckedRegistry; import com.dfsek.terra.api.util.reflection.TypeKey; @@ -94,7 +98,8 @@ public void initialize() { (type, o, loader, depthTracker) -> DistanceSampler.DistanceFunction.valueOf((String) o)) .applyLoader(DimensionApplicableNoiseSampler.class, DimensionApplicableNoiseSampler::new) .applyLoader(FunctionTemplate.class, FunctionTemplate::new) - .applyLoader(CubicSpline.Point.class, CubicSplinePointTemplate::new); + .applyLoader(CubicSpline.Point.class, CubicSplinePointTemplate::new) + .applyLoader(DerivativeNoiseSampler.class, DerivativeNoiseSamplerTemplate::new); noiseRegistry.register(addon.key("LINEAR"), LinearNormalizerTemplate::new); noiseRegistry.register(addon.key("NORMAL"), NormalNormalizerTemplate::new); @@ -117,7 +122,8 @@ public void initialize() { noiseRegistry.register(addon.key("PERLIN"), () -> new SimpleNoiseTemplate(PerlinSampler::new)); noiseRegistry.register(addon.key("SIMPLEX"), () -> new SimpleNoiseTemplate(SimplexSampler::new)); noiseRegistry.register(addon.key("GABOR"), GaborNoiseTemplate::new); - + noiseRegistry.register(addon.key("PSEUDOEROSION"), PseudoErosionTemplate::new); + noiseRegistry.register(addon.key("DERIVATIVE"), DerivativeFractalTemplate::new); noiseRegistry.register(addon.key("VALUE"), () -> new SimpleNoiseTemplate(ValueSampler::new)); noiseRegistry.register(addon.key("VALUE_CUBIC"), () -> new SimpleNoiseTemplate(ValueCubicSampler::new)); diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java new file mode 100644 index 000000000..4d01cc58b --- /dev/null +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java @@ -0,0 +1,25 @@ +package com.dfsek.terra.addons.noise.config.templates; + +import com.dfsek.tectonic.api.config.template.annotations.Value; +import com.dfsek.tectonic.api.exception.ValidationException; + +import com.dfsek.terra.api.noise.DerivativeNoiseSampler; +import com.dfsek.terra.api.noise.NoiseSampler; + + +public class DerivativeNoiseSamplerTemplate extends SamplerTemplate { + + @Value(".") + private NoiseSampler sampler; + + @Override + public boolean validate() throws ValidationException { + if (!(sampler instanceof DerivativeNoiseSampler)) throw new ValidationException("Provided sampler does not support calculating a derivative"); + return super.validate(); + } + + @Override + public DerivativeNoiseSampler get() { + return (DerivativeNoiseSampler) sampler; + } +} diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java new file mode 100644 index 000000000..9387651a2 --- /dev/null +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java @@ -0,0 +1,32 @@ +package com.dfsek.terra.addons.noise.config.templates.noise; + +import com.dfsek.tectonic.api.config.template.annotations.Default; +import com.dfsek.tectonic.api.config.template.annotations.Value; + +import com.dfsek.terra.addons.noise.config.templates.SamplerTemplate; +import com.dfsek.terra.addons.noise.samplers.noise.simplex.DerivativeFractal; + + +public class DerivativeFractalTemplate extends SamplerTemplate { + + @Value("octaves") + @Default + private int octaves = 3; + + @Value("gain") + @Default + private double gain = 0.5; + + @Value("lacunarity") + @Default + private double lacunarity = 2.0; + + @Value("frequency") + @Default + private double frequency = 0.02; + + @Override + public DerivativeFractal get() { + return new DerivativeFractal(octaves, gain, lacunarity, frequency); + } +} diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java new file mode 100644 index 000000000..b81c053f7 --- /dev/null +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java @@ -0,0 +1,62 @@ +package com.dfsek.terra.addons.noise.config.templates.noise; + +import com.dfsek.tectonic.api.config.template.annotations.Default; +import com.dfsek.tectonic.api.config.template.annotations.Value; + +import com.dfsek.terra.addons.noise.config.templates.SamplerTemplate; +import com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion; +import com.dfsek.terra.api.noise.DerivativeNoiseSampler; + + +public class PseudoErosionTemplate extends SamplerTemplate { + + @Value("octaves") + @Default + private int octaves = 4; + + @Value("lacunarity") + @Default + private double lacunarity = 2.0; + + @Value("gain") + @Default + private double gain = 0.5; + + @Value("slope-strength") + @Default + private double slopeStrength = 1.0; + + @Value("branch-strength") + @Default + private double branchStrength = 1.0; + + @Value("strength") + @Default + private double strength = 0.04; + + @Value("erosion-frequency") + @Default + private double erosionFrequency = 0.02; + + @Value("sampler") + private DerivativeNoiseSampler heightSampler; + + @Value("slope-mask.enable") + @Default + private boolean slopeMask = true; + + @Value("slope-mask.none") + @Default + private double slopeMaskNone = -0.5; + + @Value("slope-mask.full") + @Default + private double slopeMaskFull = 1; + + @Override + public PseudoErosion get() { + return new PseudoErosion(octaves, gain, lacunarity, + slopeStrength, branchStrength, strength, + erosionFrequency, heightSampler, slopeMask, slopeMaskFull, slopeMaskNone); + } +} diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java new file mode 100644 index 000000000..45928a619 --- /dev/null +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java @@ -0,0 +1,104 @@ +package com.dfsek.terra.addons.noise.samplers.noise.simplex; + +import com.dfsek.terra.api.noise.DerivativeNoiseSampler; + +import static com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion.dot; +import static com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion.hash; +import static com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion.hashX; +import static com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion.hashY; + + +/** + * Temporary sampler that provides derivatives to test pseudoerosion, should be replaced with + * derivative versions of existing samplers + */ +public class DerivativeFractal implements DerivativeNoiseSampler { + + private final int heightOctaves; + private final double heightGain; + private final double heightLacunarity; + private final double frequency; + + public DerivativeFractal(int octaves, double gain, double lacunarity, double frequency) { + this.heightOctaves = octaves; + this.heightGain = gain; + this.heightLacunarity = lacunarity; + this.frequency = frequency; + } + + private static float[] baseNoise(float px, float py) { + float ix = (float)Math.floor(px); + float iy = (float)Math.floor(py); + float fx = px - ix; + float fy = py - iy; + + float ux = fx * fx * fx * (fx * (fx * 6.0f - 15.0f) + 10.0f); + float uy = fy * fy * fy * (fy * (fy * 6.0f - 15.0f) + 10.0f); + float dux = fx * fx * 30.0f * (fx * (fx - 2.0f) + 1.0f); + float duy = fy * fy * 30.0f * (fy * (fy - 2.0f) + 1.0f); + + float gan = hash(ix, iy); + float gax = hashX(gan); + float gay = hashY(gan); + + float gbn = hash(ix + 1, iy); + float gbx = hashX(gbn); + float gby = hashY(gbn); + + float gcn = hash(ix, iy + 1); + float gcx = hashX(gcn); + float gcy = hashY(gcn); + + float gdn = hash(ix + 1, iy + 1); + float gdx = hashX(gdn); + float gdy = hashY(gdn); + + float va = dot(gax, gay, fx, fy); + float vb = dot(gbx, gby, fx - 1, fy); + float vc = dot(gcx, gcy, fx, fy - 1); + float vd = dot(gdx, gdy, fx - 1, fy - 1); + + float u2x = gax + (gbx - gax) * ux + (gcx - gax) * uy + (gax - gbx - gcx + gdx) * ux * uy + dux * (uy * (va - vb - vc + vd) + vb - va); + float u2y = gay + (gby - gay) * ux + (gcy - gay) * uy + (gay - gby - gcy + gdy) * ux * uy + duy * (ux * (va - vb - vc + vd) + vc - va); + + return new float[] { va + ux * (vb - va) + uy * (vc - va) + ux * uy * (va - vb - vc + vd), u2x, u2y }; + } + + @Override + public double[] noised(long seed, double x, double y) { + x *= frequency; + y *= frequency; + double[] out = { 0.0f, 0.0f, 0.0f }; + float heightFreq = 1.0f; + float heightAmp = 1f; + float cumAmp = 0.0f; + for (int i = 0; i < heightOctaves; i++) { + float[] noise = baseNoise((float) (x * heightFreq), (float) (y * heightFreq)); + out[0] += noise[0] * heightAmp; + out[1] += noise[1] * heightAmp * heightFreq; + out[2] += noise[2] * heightAmp * heightFreq; + cumAmp += heightAmp; + heightAmp *= heightGain; + heightFreq *= heightLacunarity; + } + out[0] /= cumAmp; + out[1] /= cumAmp; + out[2] /= cumAmp; + return out; + } + + @Override + public double[] noised(long seed, double x, double y, double z) { + return noised(seed, x, z); + } + + @Override + public double noise(long seed, double x, double y) { + return noised(seed, x, y)[0]; + } + + @Override + public double noise(long seed, double x, double y, double z) { + return noised(seed, x, y, z)[0]; + } +} diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java new file mode 100644 index 000000000..ca4ce8212 --- /dev/null +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java @@ -0,0 +1,179 @@ +package com.dfsek.terra.addons.noise.samplers.noise.simplex; + + +import com.dfsek.terra.api.noise.DerivativeNoiseSampler; +import com.dfsek.terra.api.noise.NoiseSampler; +import com.dfsek.terra.api.util.MathUtil; + + +public class PseudoErosion implements NoiseSampler { + public static final float TAU = (float) (2.0 * Math.PI); + private static final float HASH_X = 0.3183099f; + private static final float HASH_Y = 0.3678794f; + private final int octaves; + public final double gain; + public final double lacunarity; + public final double slopeStrength; + public final double branchStrength; + public final double erosionStrength; + private final double erosionFrequency; + private final DerivativeNoiseSampler sampler; + private final boolean slopeMask; + private final double slopeMaskFullSq; + private final double slopeMaskNoneSq; + + public PseudoErosion(int octaves, double gain, double lacunarity, double slopeStrength, double branchStrength, double erosionStrength, double erosionFrequency, DerivativeNoiseSampler sampler, + boolean slopeMask, double slopeMaskFull, double slopeMaskNone) { + this.octaves = octaves; + this.gain = gain; + this.lacunarity = lacunarity; + this.slopeStrength = slopeStrength; + this.branchStrength = branchStrength; + this.erosionStrength = erosionStrength; + this.erosionFrequency = erosionFrequency; + this.sampler = sampler; + this.slopeMask = slopeMask; + // Square these values and maintain sign since they're compared to a + // squared value, otherwise a sqrt would need to be used + this.slopeMaskFullSq = slopeMaskFull * slopeMaskFull * Math.signum(slopeMaskFull); + this.slopeMaskNoneSq = slopeMaskNone * slopeMaskNone * Math.signum((slopeMaskNone)); + } + + public static float hash(float x, float y) { + float xx = x * HASH_X + HASH_Y; + float yy = y * HASH_Y + HASH_X; + + // Swapped the components here + return 16 * (xx * yy * (xx + yy)); + } + + public static float hashX(float n) { + // Swapped the components here + float nx = HASH_X * n; + return -1.0f + 2.0f * fract(nx); + } + + public static float hashY(float n) { + float ny = HASH_Y * n; + return -1.0f + 2.0f * fract(ny); + } + + public static float fract(float x) { + return (x - (float)Math.floor(x)); + } + + public static float[] erosion(float x, float y, float dirX, float dirY) { + float gridX = (float) Math.floor(x); + float gridY = (float) Math.floor(y); + float localX = x - gridX; + float localY = y - gridY; + float noise = 0.0f; + float dirOutX = 0.0f; + float dirOutY = 0.0f; + float cumAmp = 0.0f; + + for (int cellX = -2; cellX < 2; cellX++) { + for (int cellY = -2; cellY < 2; cellY++) { + // TODO - Make seed affect hashing + float cellHash = hash(gridX - (float) cellX, gridY - (float) cellY); + float cellOffsetX = hashX(cellHash) * 0.5f; + float cellOffsetY = hashY(cellHash) * 0.5f; + float cellOriginDeltaX = cellX - cellOffsetX + localX; + float cellOriginDeltaY = cellY - cellOffsetY + localY; + float cellOriginDistSq = dot(cellOriginDeltaX, cellOriginDeltaY, cellOriginDeltaX, cellOriginDeltaY); + float amp = (float)exp(-cellOriginDistSq * 2.0); // Exponentially decrease amplitude further from cell center + cumAmp += amp; + float directionalStrength = dot(cellOriginDeltaX, cellOriginDeltaY, dirX, dirY) * TAU; + noise += (float) (MathUtil.cos(directionalStrength) * amp); + float sinAngle = (float) MathUtil.sin(directionalStrength) * amp; + dirOutX -= sinAngle * (cellOriginDeltaX + dirX); + dirOutY -= sinAngle * (cellOriginDeltaY + dirY); + } + } + + noise /= cumAmp; + dirOutX /= cumAmp; + dirOutY /= cumAmp; + + return new float[] {noise, dirOutX, dirOutY}; + } + + public static double exp(double val) { + final long tmp = (long) (1512775 * val + 1072632447); + return Double.longBitsToDouble(tmp << 32); + } + + public static float smoothstep(float edge0, float edge1, float x) { + // Scale, bias and saturate x to 0..1 range + x = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f); + // Evaluate polynomial + return x * x * (3 - 2 * x); + } + + public static float clamp(float x, float minVal, float maxVal) { + return Math.max(minVal, Math.min(maxVal, x)); + } + + public float heightMap(long seed, float x, float y) { + double[] sample = sampler.noised(seed, x, y); + float height = (float) sample[0]; + float heightDirX = (float) sample[1]; + float heightDirY = (float) sample[2]; + + // Take the curl of the normal to get the gradient facing down the slope + float baseDirX = heightDirY * (float) slopeStrength; + float baseDirY = -heightDirX * (float) slopeStrength; + + float erosion = 0.0f; + float dirX = 0.0f; + float dirY = 0.0f; + float amp = 1.0f; + float cumAmp = 0.0f; + float freq = 1.0f; + + // Stack erosion octaves + for (int i = 0; i < octaves; i++) { + float[] erosionResult = erosion( + x * freq * (float) erosionFrequency, + y * freq * (float) erosionFrequency, + baseDirX + dirY * (float) branchStrength, + baseDirY - dirX * (float) branchStrength); + erosion += erosionResult[0] * amp; + dirX += erosionResult[1] * amp * freq; + dirY += erosionResult[2] * amp * freq; + cumAmp += amp; + amp *= gain; + freq *= lacunarity; + } + + // TODO - Test different output ranges, see how they affect visuals + // Normalize erosion noise + erosion /= cumAmp; + // [-1, 1] -> [0, 1] + erosion = erosion * 0.5F + 0.5F; + + // Without masking, erosion noise in areas with small gradients tend to produce mounds, + // this reduces erosion amplitude towards smaller gradients to avoid this + if (slopeMask) { + float dirMagSq = dot(baseDirX, baseDirY, baseDirX, baseDirY); + float flatness = smoothstep((float) slopeMaskNoneSq, (float) slopeMaskFullSq, dirMagSq); + erosion *= flatness; + } + + return (float) (height + erosion * erosionStrength); + } + + public static float dot(float x1, float y1, float x2, float y2) { + return x1 * x2 + y1 * y2; + } + + @Override + public double noise(long seed, double x, double y) { + return heightMap(seed, (float) x, (float) y); + } + + @Override + public double noise(long seed, double x, double y, double z) { + return noise(seed, x, z); + } +} \ No newline at end of file diff --git a/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java b/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java new file mode 100644 index 000000000..12bc1e36d --- /dev/null +++ b/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java @@ -0,0 +1,22 @@ +package com.dfsek.terra.api.noise; + +/** + * A NoiseSampler which additionally provides directional derivatives + */ +public interface DerivativeNoiseSampler extends NoiseSampler { + + static boolean providesDerivative(NoiseSampler sampler) { + if (sampler instanceof DerivativeNoiseSampler dSampler) { + return dSampler.isDerivable(); + } + return false; + } + + default boolean isDerivable() { + return false; + } + + double[] noised(long seed, double x, double y); + + double[] noised(long seed, double x, double y, double z); +} From 41652d29dfa4dc6e95911ab10e4e3919f7504433 Mon Sep 17 00:00:00 2001 From: Astrash Date: Fri, 19 Apr 2024 21:05:52 +1000 Subject: [PATCH 08/56] Use proper check for derivative sampler validation --- .../noise/config/templates/DerivativeNoiseSamplerTemplate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java index 4d01cc58b..de6dbac3a 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java @@ -14,7 +14,7 @@ public class DerivativeNoiseSamplerTemplate extends SamplerTemplate Date: Fri, 19 Apr 2024 21:07:53 +1000 Subject: [PATCH 09/56] Require implementing derivable check --- .../noise/samplers/noise/simplex/DerivativeFractal.java | 5 +++++ .../com/dfsek/terra/api/noise/DerivativeNoiseSampler.java | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java index 45928a619..bbf5d8e5c 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java @@ -64,6 +64,11 @@ private static float[] baseNoise(float px, float py) { return new float[] { va + ux * (vb - va) + uy * (vc - va) + ux * uy * (va - vb - vc + vd), u2x, u2y }; } + @Override + public boolean isDerivable() { + return true; + } + @Override public double[] noised(long seed, double x, double y) { x *= frequency; diff --git a/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java b/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java index 12bc1e36d..5f341ada2 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java +++ b/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java @@ -12,9 +12,7 @@ static boolean providesDerivative(NoiseSampler sampler) { return false; } - default boolean isDerivable() { - return false; - } + boolean isDerivable(); double[] noised(long seed, double x, double y); From ff03b38b814ef4db4e1fcfe8fd559365735ada28 Mon Sep 17 00:00:00 2001 From: Astrash Date: Fri, 19 Apr 2024 21:25:16 +1000 Subject: [PATCH 10/56] Derivative API documentation --- .../DerivativeNoiseSamplerTemplate.java | 2 +- .../noise/simplex/DerivativeFractal.java | 2 +- .../api/noise/DerivativeNoiseSampler.java | 31 ++++++++++++++++--- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java index de6dbac3a..d93054ac9 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java @@ -14,7 +14,7 @@ public class DerivativeNoiseSamplerTemplate extends SamplerTemplate Date: Sat, 20 Apr 2024 15:55:59 +1000 Subject: [PATCH 11/56] Reduce number of erosion impulses A reduction of impulse evaluations from 5^2 to 3^2, original algorithm used exponential falloff function which required evaluating impulses from further away to avoid artifacts. I've changed it to a parabolic falloff function which is exactly 0 at the largest possible distance from a cell origin, meaning any cells further than that will not have an effect, preventing said artifacting from occurring. The parabolic function could be replaced with an exponential function (or any other similar easing function) as long as it has an x-intercept at maxCellDistSq. In addition, an option to control whether averaging impulses has been added as it has more of a visual impact with the aforementioned changes. --- .../noise/PseudoErosionTemplate.java | 10 +++- .../samplers/noise/simplex/PseudoErosion.java | 48 +++++++++++-------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java index b81c053f7..f5e1ac46c 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java @@ -53,10 +53,18 @@ public class PseudoErosionTemplate extends SamplerTemplate { @Default private double slopeMaskFull = 1; + @Value("jitter") + @Default + private double jitterModifier = 1; + + @Value("average-impulses") + @Default + private boolean averageErosionImpulses = true; + @Override public PseudoErosion get() { return new PseudoErosion(octaves, gain, lacunarity, slopeStrength, branchStrength, strength, - erosionFrequency, heightSampler, slopeMask, slopeMaskFull, slopeMaskNone); + erosionFrequency, heightSampler, slopeMask, slopeMaskFull, slopeMaskNone, jitterModifier, averageErosionImpulses); } } diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java index ca4ce8212..41b1e2db8 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java @@ -21,9 +21,14 @@ public class PseudoErosion implements NoiseSampler { private final boolean slopeMask; private final double slopeMaskFullSq; private final double slopeMaskNoneSq; + private final double jitter; + private final double maxCellDistSq; + private final double maxCellDistSqRecip; + private final boolean averageErosionImpulses; public PseudoErosion(int octaves, double gain, double lacunarity, double slopeStrength, double branchStrength, double erosionStrength, double erosionFrequency, DerivativeNoiseSampler sampler, - boolean slopeMask, double slopeMaskFull, double slopeMaskNone) { + boolean slopeMask, double slopeMaskFull, double slopeMaskNone, double jitterModifier, + boolean averageErosionImpulses) { this.octaves = octaves; this.gain = gain; this.lacunarity = lacunarity; @@ -37,6 +42,10 @@ public PseudoErosion(int octaves, double gain, double lacunarity, double slopeSt // squared value, otherwise a sqrt would need to be used this.slopeMaskFullSq = slopeMaskFull * slopeMaskFull * Math.signum(slopeMaskFull); this.slopeMaskNoneSq = slopeMaskNone * slopeMaskNone * Math.signum((slopeMaskNone)); + this.jitter = 0.43701595 * jitterModifier; + this.averageErosionImpulses = averageErosionImpulses; + this.maxCellDistSq = 1 + jitter * jitter; + this.maxCellDistSqRecip = 1 / maxCellDistSq; } public static float hash(float x, float y) { @@ -62,26 +71,25 @@ public static float fract(float x) { return (x - (float)Math.floor(x)); } - public static float[] erosion(float x, float y, float dirX, float dirY) { - float gridX = (float) Math.floor(x); - float gridY = (float) Math.floor(y); - float localX = x - gridX; - float localY = y - gridY; + public float[] erosion(float x, float y, float dirX, float dirY) { + int gridX = Math.round(x); + int gridY = Math.round(y); float noise = 0.0f; float dirOutX = 0.0f; float dirOutY = 0.0f; float cumAmp = 0.0f; - for (int cellX = -2; cellX < 2; cellX++) { - for (int cellY = -2; cellY < 2; cellY++) { + for (int cellX = gridX - 1; cellX <= gridX + 1; cellX++) { + for (int cellY = gridY - 1; cellY <= gridY + 1; cellY++) { // TODO - Make seed affect hashing - float cellHash = hash(gridX - (float) cellX, gridY - (float) cellY); - float cellOffsetX = hashX(cellHash) * 0.5f; - float cellOffsetY = hashY(cellHash) * 0.5f; - float cellOriginDeltaX = cellX - cellOffsetX + localX; - float cellOriginDeltaY = cellY - cellOffsetY + localY; - float cellOriginDistSq = dot(cellOriginDeltaX, cellOriginDeltaY, cellOriginDeltaX, cellOriginDeltaY); - float amp = (float)exp(-cellOriginDistSq * 2.0); // Exponentially decrease amplitude further from cell center + float cellHash = hash(cellX, cellY); + float cellOffsetX = (float) (hashX(cellHash) * jitter); + float cellOffsetY = (float) (hashY(cellHash) * jitter); + float cellOriginDeltaX = (x - cellX) + cellOffsetX; + float cellOriginDeltaY = (y - cellY) + cellOffsetY; + float cellOriginDistSq = cellOriginDeltaX * cellOriginDeltaX + cellOriginDeltaY * cellOriginDeltaY; + if (cellOriginDistSq > maxCellDistSq) continue; // Skip calculating cells too far away + float ampTmp = (float) ((cellOriginDistSq * maxCellDistSqRecip) - 1); float amp = ampTmp * ampTmp; // Decrease cell amplitude further away cumAmp += amp; float directionalStrength = dot(cellOriginDeltaX, cellOriginDeltaY, dirX, dirY) * TAU; noise += (float) (MathUtil.cos(directionalStrength) * amp); @@ -90,11 +98,11 @@ public static float[] erosion(float x, float y, float dirX, float dirY) { dirOutY -= sinAngle * (cellOriginDeltaY + dirY); } } - - noise /= cumAmp; - dirOutX /= cumAmp; - dirOutY /= cumAmp; - + if (averageErosionImpulses && cumAmp != 0) { + noise /= cumAmp; + dirOutX /= cumAmp; + dirOutY /= cumAmp; + } return new float[] {noise, dirOutX, dirOutY}; } From 62317a2f3f4a2b03e0749e5e0a4bca6a284dee83 Mon Sep 17 00:00:00 2001 From: Gavin Tran Date: Sun, 21 Apr 2024 14:48:46 -0400 Subject: [PATCH 12/56] Add SaltedNoiseFunctions --- .../noise/SaltedNoiseFunction2.java | 38 +++++++++++++++++++ .../noise/SaltedNoiseFunction3.java | 38 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java create mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction3.java diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java new file mode 100644 index 000000000..16f3b2a8e --- /dev/null +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java @@ -0,0 +1,38 @@ +package com.dfsek.terra.addons.noise.paralithic.noise; + +import com.dfsek.paralithic.functions.dynamic.Context; +import com.dfsek.paralithic.functions.dynamic.DynamicFunction; +import com.dfsek.paralithic.node.Statefulness; + +import com.dfsek.terra.api.noise.NoiseSampler; + +import org.jetbrains.annotations.NotNull; + + +public class SaltedNoiseFunction2 implements DynamicFunction { + private final NoiseSampler gen; + + public SaltedNoiseFunction2(NoiseSampler gen) { + this.gen = gen; + } + + @Override + public double eval(double... args) { + throw new UnsupportedOperationException("Cannot evaluate seeded function without seed context."); + } + + @Override + public double eval(Context context, double... args) { + return gen.noise(((SeedContext) context).getSeed() + (long) args[2], args[0], args[1]); + } + + @Override + public int getArgNumber() { + return 3; + } + + @Override + public @NotNull Statefulness statefulness() { + return Statefulness.CONTEXTUAL; + } +} diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction3.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction3.java new file mode 100644 index 000000000..5dc483d5c --- /dev/null +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction3.java @@ -0,0 +1,38 @@ +package com.dfsek.terra.addons.noise.paralithic.noise; + +import com.dfsek.paralithic.functions.dynamic.Context; +import com.dfsek.paralithic.functions.dynamic.DynamicFunction; +import com.dfsek.paralithic.node.Statefulness; + +import com.dfsek.terra.api.noise.NoiseSampler; + +import org.jetbrains.annotations.NotNull; + + +public class SaltedNoiseFunction3 implements DynamicFunction { + private final NoiseSampler gen; + + public SaltedNoiseFunction3(NoiseSampler gen) { + this.gen = gen; + } + + @Override + public double eval(double... args) { + throw new UnsupportedOperationException("Cannot evaluate seeded function without seed context."); + } + + @Override + public double eval(Context context, double... args) { + return gen.noise(((SeedContext) context).getSeed() + (long) args[3], args[0], args[1], args[2]); + } + + @Override + public int getArgNumber() { + return 4; + } + + @Override + public @NotNull Statefulness statefulness() { + return Statefulness.CONTEXTUAL; + } +} From 72f761678af082d8f8a13d2d34ca920afae0c80e Mon Sep 17 00:00:00 2001 From: Gavin Tran Date: Sun, 21 Apr 2024 14:54:45 -0400 Subject: [PATCH 13/56] Add SaltedNoiseFunctions in sampler conversion --- .../addons/noise/paralithic/FunctionUtil.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/FunctionUtil.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/FunctionUtil.java index 5dbc740ec..ef4fe2aeb 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/FunctionUtil.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/FunctionUtil.java @@ -11,6 +11,8 @@ import com.dfsek.terra.addons.noise.paralithic.defined.UserDefinedFunction; import com.dfsek.terra.addons.noise.paralithic.noise.NoiseFunction2; import com.dfsek.terra.addons.noise.paralithic.noise.NoiseFunction3; +import com.dfsek.terra.addons.noise.paralithic.noise.SaltedNoiseFunction2; +import com.dfsek.terra.addons.noise.paralithic.noise.SaltedNoiseFunction3; public class FunctionUtil { @@ -23,10 +25,15 @@ public static Map convertFunctionsAndSamplers(Map entry : functions.entrySet()) { functionMap.put(entry.getKey(), UserDefinedFunction.newInstance(entry.getValue())); } - samplers.forEach((id, sampler) -> functionMap.put(id, - sampler.getDimensions() == 2 ? - new NoiseFunction2(sampler.getSampler()) : - new NoiseFunction3(sampler.getSampler()))); + samplers.forEach((id, sampler) -> { + if (sampler.getDimensions() == 2) { + functionMap.put(id, new NoiseFunction2(sampler.getSampler())); + functionMap.put(id + "Salted", new SaltedNoiseFunction2(sampler.getSampler())); + } else { + functionMap.put(id, new NoiseFunction3(sampler.getSampler())); + functionMap.put(id + "Salted", new SaltedNoiseFunction3(sampler.getSampler())); + } + }); return functionMap; } } From c20b1eaf107f9f616d20f4429c6d746118f14b8d Mon Sep 17 00:00:00 2001 From: Gavin Tran Date: Sun, 21 Apr 2024 15:39:48 -0400 Subject: [PATCH 14/56] Apply code style fixes --- .../com/dfsek/terra/addons/noise/paralithic/FunctionUtil.java | 2 +- .../addons/noise/paralithic/noise/SaltedNoiseFunction2.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/FunctionUtil.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/FunctionUtil.java index ef4fe2aeb..d47693cde 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/FunctionUtil.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/FunctionUtil.java @@ -26,7 +26,7 @@ public static Map convertFunctionsAndSamplers(Map { - if (sampler.getDimensions() == 2) { + if(sampler.getDimensions() == 2) { functionMap.put(id, new NoiseFunction2(sampler.getSampler())); functionMap.put(id + "Salted", new SaltedNoiseFunction2(sampler.getSampler())); } else { diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java index 16f3b2a8e..2e8f72929 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java @@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; -public class SaltedNoiseFunction2 implements DynamicFunction { +public class SaltedNoiseFunction2 implements DynamicFunction { private final NoiseSampler gen; public SaltedNoiseFunction2(NoiseSampler gen) { From dd272bce64131b3470a3f30ecedbdb7be0d7fe4d Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Wed, 1 May 2024 17:04:34 -0600 Subject: [PATCH 15/56] WIP 1.20.6 --- buildSrc/build.gradle.kts | 6 ++-- buildSrc/src/main/kotlin/Versions.kt | 35 +++++++++---------- gradle/wrapper/gradle-wrapper.properties | 4 +-- .../config/BiomeParticleConfigTemplate.java | 3 +- .../java/com/dfsek/terra/mod/data/Codecs.java | 9 ++--- .../MinecraftChunkGeneratorWrapper.java | 3 +- .../mod/generation/TerraBiomeSource.java | 3 +- .../entity/MobSpawnerBlockEntityMixin.java | 4 +-- .../terra/block/state/BlockStateMixin.java | 3 +- .../src/main/resources/terra.accesswidener | 1 + 10 files changed, 38 insertions(+), 33 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 3bdfddef0..6b56f288f 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -17,10 +17,10 @@ repositories { dependencies { //TODO Allow pulling from Versions.kt implementation("com.github.johnrengelman", "shadow", "8.1.1") - implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.5.11") + implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.0") - implementation("org.ow2.asm", "asm", "9.6") - implementation("org.ow2.asm", "asm-tree", "9.6") + implementation("org.ow2.asm", "asm", "9.7") + implementation("org.ow2.asm", "asm-tree", "9.7") implementation("com.dfsek.tectonic", "common", "4.2.1") implementation("org.yaml", "snakeyaml", "2.2") } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index a150ac3b2..ba9195cc7 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -12,23 +12,22 @@ object Versions { const val caffeine = "3.1.8" - const val slf4j = "2.0.9" - const val log4j_slf4j_impl = "2.20.0" - + const val slf4j = "2.0.13" + object Internal { const val shadow = "8.1.1" - const val apacheText = "1.11.0" - const val apacheIO = "2.15.1" - const val guava = "32.1.3-jre" - const val asm = "9.6" + const val apacheText = "1.12.0" + const val apacheIO = "2.16.1" + const val guava = "33.1.0-jre" + const val asm = "9.7" const val snakeYml = "2.2" const val jetBrainsAnnotations = "24.1.0" - const val junit = "5.10.1" + const val junit = "5.10.2" } } object Fabric { - const val fabricAPI = "0.91.2+${Mod.minecraft}" + const val fabricAPI = "0.97.8+${Mod.minecraft}" } // // object Quilt { @@ -39,12 +38,12 @@ object Versions { object Mod { const val mixin = "0.12.5+mixin.0.8.5" - const val minecraft = "1.20.4" + const val minecraft = "1.20.6" const val yarn = "$minecraft+build.1" - const val fabricLoader = "0.15.1" + const val fabricLoader = "0.15.10" - const val architecuryLoom = "1.4.369" - const val architecturyPlugin = "3.4.151" + const val architecuryLoom = "1.6.395" + const val architecturyPlugin = "3.4.155" } // // object Forge { @@ -53,14 +52,14 @@ object Versions { // } object Bukkit { - const val minecraft = "1.20.4" - const val paperBuild = "$minecraft-R0.1-20231209.173338-2" + const val minecraft = "1.20.6" + const val paperBuild = "$minecraft-R0.1-20240501.172135-12" const val paper = paperBuild const val paperLib = "1.0.8" - const val reflectionRemapper = "0.1.0" + const val reflectionRemapper = "0.1.1" const val paperDevBundle = paperBuild - const val runPaper = "2.2.2" - const val paperWeight = "1.5.11" + const val runPaper = "2.3.0" + const val paperWeight = "1.7.0" } // diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index db8c3baaf..381baa9ce 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionSha256Sum=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/BiomeParticleConfigTemplate.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/BiomeParticleConfigTemplate.java index 97c8c8ed7..3bc4474b6 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/BiomeParticleConfigTemplate.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/BiomeParticleConfigTemplate.java @@ -7,6 +7,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.minecraft.command.argument.ParticleEffectArgumentType; import net.minecraft.registry.Registries; +import net.minecraft.registry.RegistryWrapper; import net.minecraft.world.biome.BiomeParticleConfig; @@ -27,7 +28,7 @@ public BiomeParticleConfig get() { try { return new BiomeParticleConfig( - ParticleEffectArgumentType.readParameters(new StringReader(particle), Registries.PARTICLE_TYPE.getReadOnlyWrapper()), + ParticleEffectArgumentType.readParameters(new StringReader(particle), (RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE.getReadOnlyWrapper()), probability); } catch(CommandSyntaxException e) { throw new RuntimeException(e); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/data/Codecs.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/data/Codecs.java index 595f5ec5b..ab7604fe5 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/data/Codecs.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/data/Codecs.java @@ -1,6 +1,7 @@ package com.dfsek.terra.mod.data; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.world.gen.chunk.ChunkGeneratorSettings; @@ -32,15 +33,15 @@ public final class Codecs { "No such config pack " + id))))); - public static final Codec TERRA_BIOME_SOURCE = RecordCodecBuilder - .create(instance -> instance.group( + public static final MapCodec TERRA_BIOME_SOURCE = RecordCodecBuilder + .mapCodec(instance -> instance.group( CONFIG_PACK.fieldOf("pack") .stable() .forGetter(TerraBiomeSource::getPack)) .apply(instance, instance.stable(TerraBiomeSource::new))); - public static final Codec MINECRAFT_CHUNK_GENERATOR_WRAPPER = RecordCodecBuilder - .create( + public static final MapCodec MINECRAFT_CHUNK_GENERATOR_WRAPPER = RecordCodecBuilder + .mapCodec( instance -> instance.group( TERRA_BIOME_SOURCE.fieldOf("biome_source") .stable() diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java index 899b007f0..8ac07a688 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java @@ -18,6 +18,7 @@ package com.dfsek.terra.mod.generation; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.registry.entry.RegistryEntry; @@ -85,7 +86,7 @@ public MinecraftChunkGeneratorWrapper(TerraBiomeSource biomeSource, ConfigPack c } @Override - protected Codec getCodec() { + protected MapCodec getCodec() { return Codecs.MINECRAFT_CHUNK_GENERATOR_WRAPPER; } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/TerraBiomeSource.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/TerraBiomeSource.java index 7aa5d8aea..533a8c98b 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/TerraBiomeSource.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/TerraBiomeSource.java @@ -18,6 +18,7 @@ package com.dfsek.terra.mod.generation; import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeSource; @@ -47,7 +48,7 @@ public TerraBiomeSource(ConfigPack pack) { } @Override - protected Codec getCodec() { + protected MapCodec getCodec() { return Codecs.TERRA_BIOME_SOURCE; } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java index ccc8b738a..2ec582417 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java @@ -50,7 +50,7 @@ private MobSpawnerBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockS public abstract MobSpawnerLogic getLogic(); @Shadow - public abstract void method_46408(net.minecraft.entity.EntityType entityType, Random random); + public abstract void setEntityType(net.minecraft.entity.EntityType entityType, Random random); public EntityType terra$getSpawnedType() { return (EntityType) Registries.ENTITY_TYPE.get( @@ -64,7 +64,7 @@ private MobSpawnerBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockS } else { rand = Random.create(); } - method_46408((net.minecraft.entity.EntityType) creatureType, rand); + setEntityType((net.minecraft.entity.EntityType) creatureType, rand); } public int terra$getDelay() { diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/state/BlockStateMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/state/BlockStateMixin.java index 7053dd4f5..9ecb3eccc 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/state/BlockStateMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/state/BlockStateMixin.java @@ -3,6 +3,7 @@ import com.google.common.collect.ImmutableMap; import com.mojang.serialization.MapCodec; +import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap; import net.minecraft.block.AbstractBlock.AbstractBlockState; import net.minecraft.block.Block; import net.minecraft.registry.Registries; @@ -24,7 +25,7 @@ @Mixin(AbstractBlockState.class) @Implements(@Interface(iface = BlockState.class, prefix = "terra$")) public abstract class BlockStateMixin extends State { - private BlockStateMixin(Block owner, ImmutableMap, Comparable> entries, + private BlockStateMixin(Block owner, Reference2ObjectArrayMap, Comparable> entries, MapCodec codec) { super(owner, entries, codec); } diff --git a/platforms/mixin-common/src/main/resources/terra.accesswidener b/platforms/mixin-common/src/main/resources/terra.accesswidener index d638bbf45..50cba4f7d 100644 --- a/platforms/mixin-common/src/main/resources/terra.accesswidener +++ b/platforms/mixin-common/src/main/resources/terra.accesswidener @@ -1,3 +1,4 @@ accessWidener v1 named accessible class net/minecraft/world/biome/Biome$Weather accessible class net/minecraft/world/gen/WorldPresets$Registrar +accessible method net/minecraft/block/FluidBlock getFluidState (Lnet/minecraft/block/BlockState;)Lnet/minecraft/fluid/FluidState From 17acde09a31d81063a29b877d0bfdd9381e09b68 Mon Sep 17 00:00:00 2001 From: Oak Date: Fri, 31 May 2024 12:11:07 +0100 Subject: [PATCH 16/56] Updated Bukkit to 1.20.6 --- .github/workflows/gradle-build.yml | 4 ++-- buildSrc/build.gradle.kts | 2 +- buildSrc/src/main/kotlin/Versions.kt | 4 ++-- platforms/bukkit/build.gradle.kts | 2 +- platforms/bukkit/nms/{v1_20_R3 => v1_20_R6}/build.gradle.kts | 0 .../dfsek/terra/bukkit/nms/v1_20_R6}/AwfulBukkitHacks.java | 2 +- .../com/dfsek/terra/bukkit/nms/v1_20_R6}/NMSBiomeInfo.java | 2 +- .../dfsek/terra/bukkit/nms/v1_20_R6}/NMSBiomeInjector.java | 2 +- .../dfsek/terra/bukkit/nms/v1_20_R6}/NMSBiomeProvider.java | 2 +- .../bukkit/nms/v1_20_R6}/NMSChunkGeneratorDelegate.java | 4 ++-- .../com/dfsek/terra/bukkit/nms/v1_20_R6}/NMSInitializer.java | 2 +- .../dfsek/terra/bukkit/nms/v1_20_R6}/NMSInjectListener.java | 4 ++-- .../dfsek/terra/bukkit/nms/v1_20_R6}/NMSWorldProperties.java | 2 +- .../com/dfsek/terra/bukkit/nms/v1_20_R6}/Reflection.java | 2 +- .../dfsek/terra/bukkit/nms/v1_20_R6}/RegistryFetcher.java | 5 ++--- 15 files changed, 19 insertions(+), 20 deletions(-) rename platforms/bukkit/nms/{v1_20_R3 => v1_20_R6}/build.gradle.kts (100%) rename platforms/bukkit/nms/{v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3 => v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6}/AwfulBukkitHacks.java (99%) rename platforms/bukkit/nms/{v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3 => v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6}/NMSBiomeInfo.java (83%) rename platforms/bukkit/nms/{v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3 => v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6}/NMSBiomeInjector.java (98%) rename platforms/bukkit/nms/{v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3 => v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6}/NMSBiomeProvider.java (97%) rename platforms/bukkit/nms/{v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3 => v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6}/NMSChunkGeneratorDelegate.java (98%) rename platforms/bukkit/nms/{v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3 => v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6}/NMSInitializer.java (90%) rename platforms/bukkit/nms/{v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3 => v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6}/NMSInjectListener.java (95%) rename platforms/bukkit/nms/{v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3 => v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6}/NMSWorldProperties.java (94%) rename platforms/bukkit/nms/{v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3 => v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6}/Reflection.java (97%) rename platforms/bukkit/nms/{v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3 => v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6}/RegistryFetcher.java (84%) diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml index 3e40fe7be..2117c7eee 100644 --- a/.github/workflows/gradle-build.yml +++ b/.github/workflows/gradle-build.yml @@ -18,10 +18,10 @@ jobs: steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 with: - java-version: '17' + java-version: '21' distribution: 'temurin' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 6b56f288f..2bf3aa5a7 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -17,7 +17,7 @@ repositories { dependencies { //TODO Allow pulling from Versions.kt implementation("com.github.johnrengelman", "shadow", "8.1.1") - implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.0") + implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.1") implementation("org.ow2.asm", "asm", "9.7") implementation("org.ow2.asm", "asm-tree", "9.7") diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index ba9195cc7..5169834f0 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -53,13 +53,13 @@ object Versions { object Bukkit { const val minecraft = "1.20.6" - const val paperBuild = "$minecraft-R0.1-20240501.172135-12" + const val paperBuild = "$minecraft-R0.1-20240530.204353-104" const val paper = paperBuild const val paperLib = "1.0.8" const val reflectionRemapper = "0.1.1" const val paperDevBundle = paperBuild const val runPaper = "2.3.0" - const val paperWeight = "1.7.0" + const val paperWeight = "1.7.1" } // diff --git a/platforms/bukkit/build.gradle.kts b/platforms/bukkit/build.gradle.kts index 6f75b0133..a63703c55 100644 --- a/platforms/bukkit/build.gradle.kts +++ b/platforms/bukkit/build.gradle.kts @@ -10,7 +10,7 @@ repositories { dependencies { shaded(project(":platforms:bukkit:common")) - shaded(project(":platforms:bukkit:nms:v1_20_R3", configuration = "reobf")) + shaded(project(":platforms:bukkit:nms:v1_20_R6", configuration = "reobf")) shaded("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper) } diff --git a/platforms/bukkit/nms/v1_20_R3/build.gradle.kts b/platforms/bukkit/nms/v1_20_R6/build.gradle.kts similarity index 100% rename from platforms/bukkit/nms/v1_20_R3/build.gradle.kts rename to platforms/bukkit/nms/v1_20_R6/build.gradle.kts diff --git a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/AwfulBukkitHacks.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/AwfulBukkitHacks.java similarity index 99% rename from platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/AwfulBukkitHacks.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/AwfulBukkitHacks.java index fa2cc9907..d6352afb8 100644 --- a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/AwfulBukkitHacks.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/AwfulBukkitHacks.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R3; +package com.dfsek.terra.bukkit.nms.v1_20_R6; import com.google.common.collect.ImmutableMap; import com.mojang.serialization.Lifecycle; diff --git a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSBiomeInfo.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInfo.java similarity index 83% rename from platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSBiomeInfo.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInfo.java index f47d21c56..fe3cbcf77 100644 --- a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSBiomeInfo.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInfo.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R3; +package com.dfsek.terra.bukkit.nms.v1_20_R6; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.biome.Biome; diff --git a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSBiomeInjector.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInjector.java similarity index 98% rename from platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSBiomeInjector.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInjector.java index e75b6fc0a..77b3c2701 100644 --- a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSBiomeInjector.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInjector.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R3; +package com.dfsek.terra.bukkit.nms.v1_20_R6; import net.minecraft.core.Holder; import net.minecraft.core.Registry; diff --git a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSBiomeProvider.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeProvider.java similarity index 97% rename from platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSBiomeProvider.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeProvider.java index 875a77fb5..e72819aba 100644 --- a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSBiomeProvider.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeProvider.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R3; +package com.dfsek.terra.bukkit.nms.v1_20_R6; import com.mojang.serialization.Codec; import net.minecraft.core.Holder; diff --git a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSChunkGeneratorDelegate.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSChunkGeneratorDelegate.java similarity index 98% rename from platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSChunkGeneratorDelegate.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSChunkGeneratorDelegate.java index 4338dc140..49c956eda 100644 --- a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSChunkGeneratorDelegate.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSChunkGeneratorDelegate.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R3; +package com.dfsek.terra.bukkit.nms.v1_20_R6; import com.mojang.serialization.Codec; import net.minecraft.core.BlockPos; @@ -19,7 +19,7 @@ import net.minecraft.world.level.levelgen.Heightmap.Types; import net.minecraft.world.level.levelgen.RandomState; import net.minecraft.world.level.levelgen.blending.Blender; -import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData; +import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSInitializer.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInitializer.java similarity index 90% rename from platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSInitializer.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInitializer.java index 084c5c30a..625275cf0 100644 --- a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSInitializer.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInitializer.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R3; +package com.dfsek.terra.bukkit.nms.v1_20_R6; import org.bukkit.Bukkit; diff --git a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSInjectListener.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInjectListener.java similarity index 95% rename from platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSInjectListener.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInjectListener.java index a81e93a3f..fddc03f9c 100644 --- a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSInjectListener.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInjectListener.java @@ -1,9 +1,9 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R3; +package com.dfsek.terra.bukkit.nms.v1_20_R6; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.chunk.ChunkGenerator; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_20_R3.CraftWorld; +import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.world.WorldInitEvent; diff --git a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSWorldProperties.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSWorldProperties.java similarity index 94% rename from platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSWorldProperties.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSWorldProperties.java index 60f6cee46..d322a2bff 100644 --- a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/NMSWorldProperties.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSWorldProperties.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R3; +package com.dfsek.terra.bukkit.nms.v1_20_R6; import net.minecraft.world.level.LevelHeightAccessor; diff --git a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/Reflection.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/Reflection.java similarity index 97% rename from platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/Reflection.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/Reflection.java index 32243da54..0b229acd2 100644 --- a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/Reflection.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/Reflection.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R3; +package com.dfsek.terra.bukkit.nms.v1_20_R6; import net.minecraft.core.Holder; import net.minecraft.core.Holder.Reference; diff --git a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/RegistryFetcher.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/RegistryFetcher.java similarity index 84% rename from platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/RegistryFetcher.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/RegistryFetcher.java index 6dbbecbc7..de2258d09 100644 --- a/platforms/bukkit/nms/v1_20_R3/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R3/RegistryFetcher.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/RegistryFetcher.java @@ -1,12 +1,11 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R3; +package com.dfsek.terra.bukkit.nms.v1_20_R6; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.server.dedicated.DedicatedServer; import net.minecraft.world.level.biome.Biome; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_20_R3.CraftServer; +import org.bukkit.craftbukkit.CraftServer; public class RegistryFetcher { From 3fa4b21247c15de31208d24ef921cb9908793188 Mon Sep 17 00:00:00 2001 From: Oak Date: Sun, 2 Jun 2024 21:27:07 +0100 Subject: [PATCH 17/56] Attempted to fix paper versions --- buildSrc/src/main/kotlin/Versions.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 5169834f0..ada0b6147 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -53,11 +53,11 @@ object Versions { object Bukkit { const val minecraft = "1.20.6" - const val paperBuild = "$minecraft-R0.1-20240530.204353-104" + const val paperBuild = "$minecraft-R0.1-20240601.143523-106" const val paper = paperBuild const val paperLib = "1.0.8" const val reflectionRemapper = "0.1.1" - const val paperDevBundle = paperBuild + const val paperDevBundle = "$minecraft-R0.1-20240601.143523-105" const val runPaper = "2.3.0" const val paperWeight = "1.7.1" } From 4536767794d36174e1fe46cb1dfa0f3f36833aed Mon Sep 17 00:00:00 2001 From: Oak Date: Mon, 3 Jun 2024 11:36:50 +0100 Subject: [PATCH 18/56] Updated to 1.20.6 --- buildSrc/build.gradle.kts | 2 +- buildSrc/src/main/kotlin/CompilationConfig.kt | 4 ++-- buildSrc/src/main/kotlin/DependencyConfig.kt | 2 +- buildSrc/src/main/kotlin/Versions.kt | 2 +- .../terra/bukkit/handles/BukkitWorldHandle.java | 2 +- .../java/com/dfsek/terra/bukkit/nms/Initializer.java | 2 +- .../nms/{v1_20_R6 => v1_20_6}/AwfulBukkitHacks.java | 6 +++--- .../nms/{v1_20_R6 => v1_20_6}/NMSBiomeInfo.java | 2 +- .../nms/{v1_20_R6 => v1_20_6}/NMSBiomeInjector.java | 2 +- .../nms/{v1_20_R6 => v1_20_6}/NMSBiomeProvider.java | 12 ++++++++---- .../NMSChunkGeneratorDelegate.java | 8 ++++---- .../nms/{v1_20_R6 => v1_20_6}/NMSInitializer.java | 2 +- .../nms/{v1_20_R6 => v1_20_6}/NMSInjectListener.java | 2 +- .../{v1_20_R6 => v1_20_6}/NMSWorldProperties.java | 2 +- .../bukkit/nms/{v1_20_R6 => v1_20_6}/Reflection.java | 2 +- .../nms/{v1_20_R6 => v1_20_6}/RegistryFetcher.java | 3 ++- 16 files changed, 30 insertions(+), 25 deletions(-) rename platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/{v1_20_R6 => v1_20_6}/AwfulBukkitHacks.java (97%) rename platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/{v1_20_R6 => v1_20_6}/NMSBiomeInfo.java (83%) rename platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/{v1_20_R6 => v1_20_6}/NMSBiomeInjector.java (98%) rename platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/{v1_20_R6 => v1_20_6}/NMSBiomeProvider.java (75%) rename platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/{v1_20_R6 => v1_20_6}/NMSChunkGeneratorDelegate.java (97%) rename platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/{v1_20_R6 => v1_20_6}/NMSInitializer.java (90%) rename platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/{v1_20_R6 => v1_20_6}/NMSInjectListener.java (97%) rename platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/{v1_20_R6 => v1_20_6}/NMSWorldProperties.java (94%) rename platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/{v1_20_R6 => v1_20_6}/Reflection.java (97%) rename platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/{v1_20_R6 => v1_20_6}/RegistryFetcher.java (91%) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 2bf3aa5a7..3d319e8c7 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -9,7 +9,7 @@ repositories { maven("https://repo.codemc.org/repository/maven-public") { name = "CodeMC" } - maven("https://papermc.io/repo/repository/maven-public/") { + maven("https://repo.papermc.io/repository/maven-public/") { name = "PaperMC" } } diff --git a/buildSrc/src/main/kotlin/CompilationConfig.kt b/buildSrc/src/main/kotlin/CompilationConfig.kt index 952b91091..f0d1e7829 100644 --- a/buildSrc/src/main/kotlin/CompilationConfig.kt +++ b/buildSrc/src/main/kotlin/CompilationConfig.kt @@ -22,8 +22,8 @@ fun Project.configureCompilation() { apply() configure { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } tasks.withType { diff --git a/buildSrc/src/main/kotlin/DependencyConfig.kt b/buildSrc/src/main/kotlin/DependencyConfig.kt index 58bde514c..0778808d8 100644 --- a/buildSrc/src/main/kotlin/DependencyConfig.kt +++ b/buildSrc/src/main/kotlin/DependencyConfig.kt @@ -36,7 +36,7 @@ fun Project.configureDependencies() { maven("https://repo.codemc.org/repository/maven-public") { name = "CodeMC" } - maven("https://papermc.io/repo/repository/maven-public/") { + maven("https://repo.papermc.io/repository/maven-public/") { name = "PaperMC" } maven("https://files.minecraftforge.net/maven/") { diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index ada0b6147..748399512 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -53,7 +53,7 @@ object Versions { object Bukkit { const val minecraft = "1.20.6" - const val paperBuild = "$minecraft-R0.1-20240601.143523-106" + const val paperBuild = "$minecraft-R0.1-20240602.222958-107" const val paper = paperBuild const val paperLib = "1.0.8" const val reflectionRemapper = "0.1.1" diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/handles/BukkitWorldHandle.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/handles/BukkitWorldHandle.java index e3b92b069..c6113bbd7 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/handles/BukkitWorldHandle.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/handles/BukkitWorldHandle.java @@ -72,7 +72,7 @@ public BukkitWorldHandle() { String entityID = id.toUpperCase(Locale.ROOT).substring(10); return new BukkitEntityType(switch(entityID) { - case "END_CRYSTAL" -> org.bukkit.entity.EntityType.ENDER_CRYSTAL; + case "END_CRYSTAL" -> org.bukkit.entity.EntityType.END_CRYSTAL; case "ENDER_CRYSTAL" -> throw new IllegalArgumentException( "Invalid entity identifier " + id); // make sure this issue can't happen the other way around. default -> org.bukkit.entity.EntityType.valueOf(entityID); diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java index 413250d57..2b9217847 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java @@ -8,7 +8,7 @@ public interface Initializer { - String NMS = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; + String NMS = "v" + Bukkit.getServer().getMinecraftVersion().replace(".", "_"); String TERRA_PACKAGE = Initializer.class.getPackageName(); static boolean init(PlatformImpl platform) { diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/AwfulBukkitHacks.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/AwfulBukkitHacks.java similarity index 97% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/AwfulBukkitHacks.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/AwfulBukkitHacks.java index d6352afb8..d052b8109 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/AwfulBukkitHacks.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/AwfulBukkitHacks.java @@ -1,10 +1,10 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R6; +package com.dfsek.terra.bukkit.nms.v1_20_6; import com.google.common.collect.ImmutableMap; -import com.mojang.serialization.Lifecycle; import net.minecraft.core.Holder; import net.minecraft.core.Holder.Reference; import net.minecraft.core.MappedRegistry; +import net.minecraft.core.RegistrationInfo; import net.minecraft.core.WritableRegistry; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; @@ -49,7 +49,7 @@ public static void registerBiomes(ConfigRegistry configRegistry) { new ResourceLocation("terra", NMSBiomeInjector.createBiomeID(pack, key)) ); - Reference holder = biomeRegistry.register(delegateKey, platform, Lifecycle.stable()); + Reference holder = biomeRegistry.register(delegateKey, platform, RegistrationInfo.BUILT_IN); Reflection.REFERENCE.invokeBindValue(holder, platform); // IMPORTANT: bind holder. platformBiome.getContext().put(new NMSBiomeInfo(delegateKey)); diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInfo.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInfo.java similarity index 83% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInfo.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInfo.java index fe3cbcf77..a62604447 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInfo.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInfo.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R6; +package com.dfsek.terra.bukkit.nms.v1_20_6; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.biome.Biome; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInjector.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInjector.java similarity index 98% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInjector.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInjector.java index 77b3c2701..deba15dec 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeInjector.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInjector.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R6; +package com.dfsek.terra.bukkit.nms.v1_20_6; import net.minecraft.core.Holder; import net.minecraft.core.Registry; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeProvider.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeProvider.java similarity index 75% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeProvider.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeProvider.java index e72819aba..79861c7e4 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSBiomeProvider.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeProvider.java @@ -1,6 +1,6 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R6; +package com.dfsek.terra.bukkit.nms.v1_20_6; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.world.level.biome.Biome; @@ -35,8 +35,12 @@ protected Stream> collectPossibleBiomes() { } @Override - protected @NotNull Codec codec() { - return BiomeSource.CODEC; + protected @NotNull MapCodec codec() { + return MapCodec.assumeMapUnsafe(BiomeSource.CODEC); +// return MapCodec.unit(null); +// BuiltInRegistries.BIOME_SOURCE.byNameCodec().dispatchMap(this::codec, Function.identity()); +// BuiltInRegistries.BIOME_SOURCE.byNameCodec().dispatchStable(BiomeSource::codec, Function.identity()); +// return BiomeSource.CODEC; } @Override diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSChunkGeneratorDelegate.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSChunkGeneratorDelegate.java similarity index 97% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSChunkGeneratorDelegate.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSChunkGeneratorDelegate.java index 49c956eda..0aadfcb9e 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSChunkGeneratorDelegate.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSChunkGeneratorDelegate.java @@ -1,6 +1,6 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R6; +package com.dfsek.terra.bukkit.nms.v1_20_6; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.server.level.WorldGenRegion; import net.minecraft.world.level.LevelAccessor; @@ -54,8 +54,8 @@ public NMSChunkGeneratorDelegate(ChunkGenerator vanilla, ConfigPack pack, NMSBio } @Override - protected @NotNull Codec codec() { - return ChunkGenerator.CODEC; + protected @NotNull MapCodec codec() { + return MapCodec.assumeMapUnsafe(ChunkGenerator.CODEC); } @Override diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInitializer.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInitializer.java similarity index 90% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInitializer.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInitializer.java index 625275cf0..8ac1b46c9 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInitializer.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInitializer.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R6; +package com.dfsek.terra.bukkit.nms.v1_20_6; import org.bukkit.Bukkit; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInjectListener.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInjectListener.java similarity index 97% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInjectListener.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInjectListener.java index fddc03f9c..22e153139 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSInjectListener.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInjectListener.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R6; +package com.dfsek.terra.bukkit.nms.v1_20_6; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.chunk.ChunkGenerator; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSWorldProperties.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSWorldProperties.java similarity index 94% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSWorldProperties.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSWorldProperties.java index d322a2bff..386192103 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/NMSWorldProperties.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSWorldProperties.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R6; +package com.dfsek.terra.bukkit.nms.v1_20_6; import net.minecraft.world.level.LevelHeightAccessor; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/Reflection.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/Reflection.java similarity index 97% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/Reflection.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/Reflection.java index 0b229acd2..77652cd6e 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/Reflection.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/Reflection.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R6; +package com.dfsek.terra.bukkit.nms.v1_20_6; import net.minecraft.core.Holder; import net.minecraft.core.Holder.Reference; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/RegistryFetcher.java b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/RegistryFetcher.java similarity index 91% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/RegistryFetcher.java rename to platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/RegistryFetcher.java index de2258d09..ca511dffa 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_R6/RegistryFetcher.java +++ b/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/RegistryFetcher.java @@ -1,10 +1,11 @@ -package com.dfsek.terra.bukkit.nms.v1_20_R6; +package com.dfsek.terra.bukkit.nms.v1_20_6; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.server.dedicated.DedicatedServer; import net.minecraft.world.level.biome.Biome; +import org.bukkit.Bukkit; import org.bukkit.craftbukkit.CraftServer; From 9e60db4b0da03f59c7991a93659b9c4ea40f8362 Mon Sep 17 00:00:00 2001 From: Oak Date: Mon, 10 Jun 2024 11:07:24 +0100 Subject: [PATCH 19/56] Updated MinecraftVersionInfo --- .../main/java/com/dfsek/terra/bukkit/util/VersionUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java index 6bc06a437..848befc60 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java @@ -77,13 +77,13 @@ public boolean isSpigot() { public static final class MinecraftVersionInfo { private static final Logger logger = LoggerFactory.getLogger(MinecraftVersionInfo.class); - private static final Pattern VERSION_PATTERN = Pattern.compile("v?(\\d+)_(\\d+)_R(\\d+)"); + private static final Pattern VERSION_PATTERN = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)"); private final int major; private final int minor; private final int patch; private MinecraftVersionInfo() { - this(Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]); + this(Bukkit.getServer().getMinecraftVersion()); } private MinecraftVersionInfo(int major, int minor, int patch) { From 4e7de501c038be60df2f18004de6d7323e5a4282 Mon Sep 17 00:00:00 2001 From: Oak Date: Sun, 16 Jun 2024 19:21:34 +0100 Subject: [PATCH 20/56] Updated bukkit platform to 1.21 --- buildSrc/src/main/kotlin/Versions.kt | 6 ++--- platforms/bukkit/build.gradle.kts | 2 +- .../nms/{v1_20_R6 => v1_21}/build.gradle.kts | 0 .../bukkit/nms/v1_21}/AwfulBukkitHacks.java | 6 ++--- .../terra/bukkit/nms/v1_21}/NMSBiomeInfo.java | 2 +- .../bukkit/nms/v1_21}/NMSBiomeInjector.java | 2 +- .../bukkit/nms/v1_21}/NMSBiomeProvider.java | 2 +- .../nms/v1_21}/NMSChunkGeneratorDelegate.java | 11 ++++----- .../bukkit/nms/v1_21}/NMSInitializer.java | 2 +- .../bukkit/nms/v1_21}/NMSInjectListener.java | 23 +++++++++++++++++-- .../bukkit/nms/v1_21}/NMSWorldProperties.java | 2 +- .../terra/bukkit/nms/v1_21}/Reflection.java | 2 +- .../bukkit/nms/v1_21}/RegistryFetcher.java | 2 +- 13 files changed, 40 insertions(+), 22 deletions(-) rename platforms/bukkit/nms/{v1_20_R6 => v1_21}/build.gradle.kts (100%) rename platforms/bukkit/nms/{v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6 => v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21}/AwfulBukkitHacks.java (93%) rename platforms/bukkit/nms/{v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6 => v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21}/NMSBiomeInfo.java (83%) rename platforms/bukkit/nms/{v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6 => v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21}/NMSBiomeInjector.java (98%) rename platforms/bukkit/nms/{v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6 => v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21}/NMSBiomeProvider.java (97%) rename platforms/bukkit/nms/{v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6 => v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21}/NMSChunkGeneratorDelegate.java (93%) rename platforms/bukkit/nms/{v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6 => v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21}/NMSInitializer.java (90%) rename platforms/bukkit/nms/{v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6 => v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21}/NMSInjectListener.java (61%) rename platforms/bukkit/nms/{v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6 => v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21}/NMSWorldProperties.java (94%) rename platforms/bukkit/nms/{v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6 => v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21}/Reflection.java (97%) rename platforms/bukkit/nms/{v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6 => v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21}/RegistryFetcher.java (94%) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 748399512..512af9721 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -52,12 +52,12 @@ object Versions { // } object Bukkit { - const val minecraft = "1.20.6" - const val paperBuild = "$minecraft-R0.1-20240602.222958-107" + const val minecraft = "1.21" + const val paperBuild = "$minecraft-R0.1-20240615.005026-1" const val paper = paperBuild const val paperLib = "1.0.8" const val reflectionRemapper = "0.1.1" - const val paperDevBundle = "$minecraft-R0.1-20240601.143523-105" + const val paperDevBundle = paperBuild const val runPaper = "2.3.0" const val paperWeight = "1.7.1" } diff --git a/platforms/bukkit/build.gradle.kts b/platforms/bukkit/build.gradle.kts index a63703c55..95924dadd 100644 --- a/platforms/bukkit/build.gradle.kts +++ b/platforms/bukkit/build.gradle.kts @@ -10,7 +10,7 @@ repositories { dependencies { shaded(project(":platforms:bukkit:common")) - shaded(project(":platforms:bukkit:nms:v1_20_R6", configuration = "reobf")) + shaded(project(":platforms:bukkit:nms:v1_21", configuration = "reobf")) shaded("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper) } diff --git a/platforms/bukkit/nms/v1_20_R6/build.gradle.kts b/platforms/bukkit/nms/v1_21/build.gradle.kts similarity index 100% rename from platforms/bukkit/nms/v1_20_R6/build.gradle.kts rename to platforms/bukkit/nms/v1_21/build.gradle.kts diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/AwfulBukkitHacks.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java similarity index 93% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/AwfulBukkitHacks.java rename to platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java index d052b8109..d16bbbf30 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/AwfulBukkitHacks.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_6; +package com.dfsek.terra.bukkit.nms.v1_21; import com.google.common.collect.ImmutableMap; import net.minecraft.core.Holder; @@ -41,12 +41,12 @@ public static void registerBiomes(ConfigRegistry configRegistry) { try { BukkitPlatformBiome platformBiome = (BukkitPlatformBiome) biome.getPlatformBiome(); NamespacedKey vanillaBukkitKey = platformBiome.getHandle().getKey(); - ResourceLocation vanillaMinecraftKey = new ResourceLocation(vanillaBukkitKey.getNamespace(), vanillaBukkitKey.getKey()); + ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(), vanillaBukkitKey.getKey()); Biome platform = NMSBiomeInjector.createBiome(biome, Objects.requireNonNull(biomeRegistry.get(vanillaMinecraftKey))); ResourceKey delegateKey = ResourceKey.create( Registries.BIOME, - new ResourceLocation("terra", NMSBiomeInjector.createBiomeID(pack, key)) + ResourceLocation.fromNamespaceAndPath("terra", NMSBiomeInjector.createBiomeID(pack, key)) ); Reference holder = biomeRegistry.register(delegateKey, platform, RegistrationInfo.BUILT_IN); diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInfo.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeInfo.java similarity index 83% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInfo.java rename to platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeInfo.java index a62604447..5bf85aa6d 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInfo.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeInfo.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_6; +package com.dfsek.terra.bukkit.nms.v1_21; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.biome.Biome; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInjector.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeInjector.java similarity index 98% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInjector.java rename to platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeInjector.java index deba15dec..e6d1f7869 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeInjector.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeInjector.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_6; +package com.dfsek.terra.bukkit.nms.v1_21; import net.minecraft.core.Holder; import net.minecraft.core.Registry; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeProvider.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeProvider.java similarity index 97% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeProvider.java rename to platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeProvider.java index 79861c7e4..18184144f 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSBiomeProvider.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeProvider.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_6; +package com.dfsek.terra.bukkit.nms.v1_21; import com.mojang.serialization.MapCodec; import net.minecraft.core.Holder; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSChunkGeneratorDelegate.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSChunkGeneratorDelegate.java similarity index 93% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSChunkGeneratorDelegate.java rename to platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSChunkGeneratorDelegate.java index 0aadfcb9e..16097df27 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSChunkGeneratorDelegate.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSChunkGeneratorDelegate.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_6; +package com.dfsek.terra.bukkit.nms.v1_21; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; @@ -26,7 +26,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; import com.dfsek.terra.api.config.ConfigPack; import com.dfsek.terra.api.world.biome.generation.BiomeProvider; @@ -87,10 +86,10 @@ public int getGenDepth() { } @Override - public @NotNull CompletableFuture fillFromNoise(@NotNull Executor executor, @NotNull Blender blender, - @NotNull RandomState noiseConfig, - @NotNull StructureManager structureAccessor, @NotNull ChunkAccess chunk) { - return vanilla.fillFromNoise(executor, blender, noiseConfig, structureAccessor, chunk) + public CompletableFuture fillFromNoise(@NotNull Blender blender, + @NotNull RandomState noiseConfig, + @NotNull StructureManager structureAccessor, @NotNull ChunkAccess chunk) { + return vanilla.fillFromNoise(blender, noiseConfig, structureAccessor, chunk) .thenApply(c -> { LevelAccessor level = Reflection.STRUCTURE_MANAGER.getLevel(structureAccessor); BiomeProvider biomeProvider = pack.getBiomeProvider(); diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInitializer.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInitializer.java similarity index 90% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInitializer.java rename to platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInitializer.java index 8ac1b46c9..18f1a058f 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInitializer.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInitializer.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_6; +package com.dfsek.terra.bukkit.nms.v1_21; import org.bukkit.Bukkit; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInjectListener.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java similarity index 61% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInjectListener.java rename to platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java index 22e153139..98510ff88 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSInjectListener.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java @@ -1,7 +1,9 @@ -package com.dfsek.terra.bukkit.nms.v1_20_6; +package com.dfsek.terra.bukkit.nms.v1_21; +import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.chunk.status.WorldGenContext; import org.bukkit.World; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.EventHandler; @@ -10,6 +12,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.lang.reflect.Field; import java.util.HashSet; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; @@ -37,8 +40,24 @@ public void onWorldInit(WorldInitEvent event) { ChunkGenerator vanilla = serverWorld.getChunkSource().getGenerator(); NMSBiomeProvider provider = new NMSBiomeProvider(pack.getBiomeProvider(), craftWorld.getSeed()); + ChunkMap chunkMap = serverWorld.getChunkSource().chunkMap; - serverWorld.getChunkSource().chunkMap.generator = new NMSChunkGeneratorDelegate(vanilla, pack, provider, craftWorld.getSeed()); + try { + Field worldGenContextField = chunkMap.getClass().getDeclaredField("worldGenContext"); + worldGenContextField.setAccessible(true); + + WorldGenContext worldGenContext = (WorldGenContext) worldGenContextField.get(chunkMap); + worldGenContextField.set(chunkMap, + new WorldGenContext( + worldGenContext.level(), + new NMSChunkGeneratorDelegate(vanilla, pack, provider, craftWorld.getSeed()), + worldGenContext.structureManager(), + worldGenContext.lightEngine(), + worldGenContext.mainThreadMailBox() + )); + } catch(NoSuchFieldException | IllegalAccessException e) { + throw new RuntimeException(e); + } LOGGER.info("Successfully injected into world."); diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSWorldProperties.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSWorldProperties.java similarity index 94% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSWorldProperties.java rename to platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSWorldProperties.java index 386192103..7860cf530 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/NMSWorldProperties.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSWorldProperties.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_6; +package com.dfsek.terra.bukkit.nms.v1_21; import net.minecraft.world.level.LevelHeightAccessor; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/Reflection.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/Reflection.java similarity index 97% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/Reflection.java rename to platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/Reflection.java index 77652cd6e..57e1b8c9c 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/Reflection.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/Reflection.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_6; +package com.dfsek.terra.bukkit.nms.v1_21; import net.minecraft.core.Holder; import net.minecraft.core.Holder.Reference; diff --git a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/RegistryFetcher.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/RegistryFetcher.java similarity index 94% rename from platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/RegistryFetcher.java rename to platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/RegistryFetcher.java index ca511dffa..0377eea0f 100644 --- a/platforms/bukkit/nms/v1_20_R6/src/main/java/com/dfsek/terra/bukkit/nms/v1_20_6/RegistryFetcher.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/RegistryFetcher.java @@ -1,4 +1,4 @@ -package com.dfsek.terra.bukkit.nms.v1_20_6; +package com.dfsek.terra.bukkit.nms.v1_21; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; From d810cad8d05b77a9a344751800ed3cf79c791611 Mon Sep 17 00:00:00 2001 From: Oak Date: Mon, 17 Jun 2024 15:50:06 +0100 Subject: [PATCH 21/56] Adjusted code for Spigot compatibility --- .../main/java/com/dfsek/terra/bukkit/nms/Initializer.java | 5 +++-- .../main/java/com/dfsek/terra/bukkit/util/VersionUtil.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java index 2b9217847..db50be325 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java @@ -1,6 +1,7 @@ package com.dfsek.terra.bukkit.nms; -import org.bukkit.Bukkit; +import com.dfsek.terra.bukkit.util.VersionUtil; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -8,7 +9,7 @@ public interface Initializer { - String NMS = "v" + Bukkit.getServer().getMinecraftVersion().replace(".", "_"); + String NMS = "v" + VersionUtil.getMinecraftVersionInfo().toString().replace(".", "_"); String TERRA_PACKAGE = Initializer.class.getPackageName(); static boolean init(PlatformImpl platform) { diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java index 848befc60..97f4b713f 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java @@ -83,7 +83,7 @@ public static final class MinecraftVersionInfo { private final int patch; private MinecraftVersionInfo() { - this(Bukkit.getServer().getMinecraftVersion()); + this(Bukkit.getServer().getBukkitVersion().split("-")[0]); } private MinecraftVersionInfo(int major, int minor, int patch) { From 0758e13bc76fd1276ee6f81a3a57dca8b03c7e35 Mon Sep 17 00:00:00 2001 From: Oak Date: Wed, 19 Jun 2024 13:33:55 +0100 Subject: [PATCH 22/56] Made patch version optional as not all Minecraft versions have a patch number --- .../java/com/dfsek/terra/bukkit/nms/Initializer.java | 2 +- .../java/com/dfsek/terra/bukkit/util/VersionUtil.java | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java index db50be325..1ca6f8c3f 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java @@ -9,7 +9,7 @@ public interface Initializer { - String NMS = "v" + VersionUtil.getMinecraftVersionInfo().toString().replace(".", "_"); + String NMS = VersionUtil.getMinecraftVersionInfo().toString().replace(".", "_"); String TERRA_PACKAGE = Initializer.class.getPackageName(); static boolean init(PlatformImpl platform) { diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java index 97f4b713f..6a8c662e0 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java @@ -77,7 +77,7 @@ public boolean isSpigot() { public static final class MinecraftVersionInfo { private static final Logger logger = LoggerFactory.getLogger(MinecraftVersionInfo.class); - private static final Pattern VERSION_PATTERN = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)"); + private static final Pattern VERSION_PATTERN = Pattern.compile("(\\d+)\\.(\\d+)(?:\\.(\\d+))?"); private final int major; private final int minor; private final int patch; @@ -97,7 +97,7 @@ private MinecraftVersionInfo(String versionString) { if(versionMatcher.find()) { major = Integer.parseInt(versionMatcher.group(1)); minor = Integer.parseInt(versionMatcher.group(2)); - patch = Integer.parseInt(versionMatcher.group(3)); + patch = versionMatcher.group(3) != null ? Integer.parseInt(versionMatcher.group(3)) : -1; } else { logger.warn("Error while parsing minecraft version info. Continuing launch, but setting all versions to -1."); @@ -112,7 +112,11 @@ public String toString() { if(major == -1 && minor == -1 && patch == -1) return "Unknown"; - return String.format("v%d.%d.%d", major, minor, patch); + if (patch >= 0) { + return String.format("v%d.%d.%d", major, minor, patch); + } else { + return String.format("v%d.%d", major, minor); + } } public int getMajor() { From fddc9a52b94eb326c95513adc63cb2cf0e560ec8 Mon Sep 17 00:00:00 2001 From: Oak Date: Wed, 19 Jun 2024 13:34:35 +0100 Subject: [PATCH 23/56] Temporarily disabled commands whilst awaiting Cloud Framework update --- .../com/dfsek/terra/bukkit/TerraBukkitPlugin.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java index 555d073c7..b6c9a6e1d 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java @@ -96,13 +96,14 @@ private PaperCommandManager getCommandSenderPaperCommandManager() CommandExecutionCoordinator.simpleCoordinator(), BukkitAdapter::adapt, BukkitAdapter::adapt); - if(commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { - commandManager.registerBrigadier(); - final CloudBrigadierManager brigManager = commandManager.brigadierManager(); - if(brigManager != null) { - brigManager.setNativeNumberSuggestions(false); - } - } + // TODO: Uncomment once Cloud has updated for 1.21 +// if(commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { +// commandManager.registerBrigadier(); +// final CloudBrigadierManager brigManager = commandManager.brigadierManager(); +// if(brigManager != null) { +// brigManager.setNativeNumberSuggestions(false); +// } +// } if(commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { commandManager.registerAsynchronousCompletions(); From e7cc2753401d7ca67739a036b26665492fd3d185 Mon Sep 17 00:00:00 2001 From: Oak Date: Sun, 23 Jun 2024 14:16:50 +0100 Subject: [PATCH 24/56] Corrected issues with worldGenContext not correctly being set (Ref: https://stackoverflow.com/questions/56039341/get-declared-fields-of-java-lang-reflect-fields-in-jdk12/56043252#56043252) --- .../api/util/reflection/ReflectionUtil.java | 21 +++++++++++++++ .../bukkit/nms/v1_21/NMSInjectListener.java | 26 +++++++++---------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/reflection/ReflectionUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/reflection/ReflectionUtil.java index 8e35c3f9f..6b0c8fd28 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/reflection/ReflectionUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/reflection/ReflectionUtil.java @@ -8,6 +8,7 @@ package com.dfsek.terra.api.util.reflection; import org.jetbrains.annotations.NotNull; +import sun.misc.Unsafe; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; @@ -26,6 +27,18 @@ public final class ReflectionUtil { + private static final Unsafe UNSAFE; + + static { + try{ + final Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe"); + unsafeField.setAccessible(true); + UNSAFE = (Unsafe) unsafeField.get(null); + } catch(NoSuchFieldException | IllegalAccessException e){ + throw new RuntimeException(e); + } + } + public static Field[] getFields(@NotNull Class type) { Field[] result = type.getDeclaredFields(); Class parentClass = type.getSuperclass(); @@ -35,6 +48,14 @@ public static Field[] getFields(@NotNull Class type) { return result; } + public static void setFinalField(Object obj, String fieldName, Object value) throws NoSuchFieldException { + Field field = obj.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + long fieldOffset = UNSAFE.objectFieldOffset(field); + + UNSAFE.putObject(obj, fieldOffset, value); + } + public static Method[] getMethods(@NotNull Class type) { Method[] result = type.getDeclaredMethods(); Class parentClass = type.getSuperclass(); diff --git a/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java index 98510ff88..b471faa88 100644 --- a/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java @@ -1,9 +1,12 @@ package com.dfsek.terra.bukkit.nms.v1_21; +import com.dfsek.terra.api.util.reflection.ReflectionUtil; + import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.status.WorldGenContext; +import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.EventHandler; @@ -12,7 +15,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.reflect.Field; import java.util.HashSet; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; @@ -41,21 +43,17 @@ public void onWorldInit(WorldInitEvent event) { ChunkGenerator vanilla = serverWorld.getChunkSource().getGenerator(); NMSBiomeProvider provider = new NMSBiomeProvider(pack.getBiomeProvider(), craftWorld.getSeed()); ChunkMap chunkMap = serverWorld.getChunkSource().chunkMap; + WorldGenContext worldGenContext = chunkMap.worldGenContext; try { - Field worldGenContextField = chunkMap.getClass().getDeclaredField("worldGenContext"); - worldGenContextField.setAccessible(true); - - WorldGenContext worldGenContext = (WorldGenContext) worldGenContextField.get(chunkMap); - worldGenContextField.set(chunkMap, - new WorldGenContext( - worldGenContext.level(), - new NMSChunkGeneratorDelegate(vanilla, pack, provider, craftWorld.getSeed()), - worldGenContext.structureManager(), - worldGenContext.lightEngine(), - worldGenContext.mainThreadMailBox() - )); - } catch(NoSuchFieldException | IllegalAccessException e) { + ReflectionUtil.setFinalField(chunkMap, "worldGenContext", new WorldGenContext( + worldGenContext.level(), + new NMSChunkGeneratorDelegate(vanilla, pack, provider, craftWorld.getSeed()), + worldGenContext.structureManager(), + worldGenContext.lightEngine(), + worldGenContext.mainThreadMailBox() + )); + } catch(NoSuchFieldException e) { throw new RuntimeException(e); } From 44d23573b3c2c4f19f8b56492ac9c8218a83cfac Mon Sep 17 00:00:00 2001 From: Oak Date: Sat, 20 Jul 2024 20:17:25 +0100 Subject: [PATCH 25/56] Updated dependencies to Paper 1.21 snapshot --- buildSrc/src/main/kotlin/Versions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 512af9721..933986d54 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -53,7 +53,7 @@ object Versions { object Bukkit { const val minecraft = "1.21" - const val paperBuild = "$minecraft-R0.1-20240615.005026-1" + const val paperBuild = "$minecraft-R0.1-SNAPSHOT" const val paper = paperBuild const val paperLib = "1.0.8" const val reflectionRemapper = "0.1.1" From 922cd35e84f2968e559051542f7b652bf612ebf8 Mon Sep 17 00:00:00 2001 From: OakLoaf Date: Fri, 16 Aug 2024 11:07:03 +0100 Subject: [PATCH 26/56] Updated Cloud dependency to v2 --- buildSrc/src/main/kotlin/Versions.kt | 4 +- .../commands/addons/AddonsCommandAddon.java | 12 +- .../commands/packs/PacksCommandAddon.java | 20 +-- .../profiler/ProfilerCommandAddon.java | 28 ++--- .../structure/StructureCommandAddon.java | 25 ++-- common/api/build.gradle.kts | 2 +- .../command/arguments/RegistryArgument.java | 117 ++++++++---------- .../platform/CommandRegistrationEvent.java | 4 +- platforms/bukkit/common/build.gradle.kts | 2 +- .../dfsek/terra/bukkit/TerraBukkitPlugin.java | 42 ++++--- platforms/fabric/build.gradle.kts | 10 +- platforms/mixin-lifecycle/build.gradle.kts | 2 +- .../terra/lifecycle/LifecycleEntryPoint.java | 3 +- 13 files changed, 133 insertions(+), 138 deletions(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 933986d54..f6e2606e0 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -8,7 +8,9 @@ object Versions { const val paralithic = "0.7.1" const val strata = "1.3.2" - const val cloud = "1.8.4" + const val cloud = "2.0.0-rc.2" + const val cloudPaper = "2.0.0-beta.9" + const val cloudFabric = "2.0.0-beta.7" const val caffeine = "3.1.8" diff --git a/common/addons/command-addons/src/main/java/com/dfsek/terra/addons/commands/addons/AddonsCommandAddon.java b/common/addons/command-addons/src/main/java/com/dfsek/terra/addons/commands/addons/AddonsCommandAddon.java index 58a22ef7a..3277c0089 100644 --- a/common/addons/command-addons/src/main/java/com/dfsek/terra/addons/commands/addons/AddonsCommandAddon.java +++ b/common/addons/command-addons/src/main/java/com/dfsek/terra/addons/commands/addons/AddonsCommandAddon.java @@ -1,8 +1,5 @@ package com.dfsek.terra.addons.commands.addons; -import cloud.commandframework.ArgumentDescription; -import cloud.commandframework.CommandManager; - import com.dfsek.terra.addons.manifest.api.AddonInitializer; import com.dfsek.terra.api.Platform; import com.dfsek.terra.api.addon.BaseAddon; @@ -12,6 +9,9 @@ import com.dfsek.terra.api.event.functional.FunctionalEventHandler; import com.dfsek.terra.api.inject.annotations.Inject; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.description.Description; + public class AddonsCommandAddon implements AddonInitializer { @Inject @@ -30,7 +30,7 @@ public void initialize() { CommandManager manager = event.getCommandManager(); manager.command( - manager.commandBuilder("addons", ArgumentDescription.of("List installed Terra addons")) + manager.commandBuilder("addons", Description.of("List installed Terra addons")) .permission("terra.addons") .handler(context -> { StringBuilder addons = new StringBuilder("Installed addons:\n"); @@ -41,7 +41,7 @@ public void initialize() { .append('@') .append(addon.getVersion().getFormatted()) .append('\n')); - context.getSender().sendMessage(addons.toString()); + context.sender().sendMessage(addons.toString()); }) ) .command( @@ -61,7 +61,7 @@ public void initialize() { .append('@') .append(versions.getFormatted()) .append('\n')); - context.getSender().sendMessage(addonInfo.toString()); + context.sender().sendMessage(addonInfo.toString()); }) ); }); diff --git a/common/addons/command-packs/src/main/java/com/dfsek/terra/addons/commands/packs/PacksCommandAddon.java b/common/addons/command-packs/src/main/java/com/dfsek/terra/addons/commands/packs/PacksCommandAddon.java index 1d99af328..6b840ef1f 100644 --- a/common/addons/command-packs/src/main/java/com/dfsek/terra/addons/commands/packs/PacksCommandAddon.java +++ b/common/addons/command-packs/src/main/java/com/dfsek/terra/addons/commands/packs/PacksCommandAddon.java @@ -1,7 +1,7 @@ package com.dfsek.terra.addons.commands.packs; -import cloud.commandframework.ArgumentDescription; -import cloud.commandframework.CommandManager; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.description.Description; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,7 +35,7 @@ public void initialize() { CommandManager manager = event.getCommandManager(); manager.command( - manager.commandBuilder("packs", ArgumentDescription.of("List installed config packs")) + manager.commandBuilder("packs", Description.of("List installed config packs")) .permission("terra.packs") .handler(context -> { StringBuilder packs = new StringBuilder("Installed packs:\n"); @@ -43,12 +43,12 @@ public void initialize() { .append(pack.getID()) .append('@') .append(pack.getVersion().getFormatted())); - context.getSender().sendMessage(packs.toString()); + context.sender().sendMessage(packs.toString()); }) ) .command( manager.commandBuilder("packs") - .literal("info", ArgumentDescription.of("Get information about a pack")) + .literal("info", Description.of("Get information about a pack")) .permission("terra.packs.info") .argument(RegistryArgument.of("pack", platform.getConfigRegistry())) .handler(context -> { @@ -65,21 +65,21 @@ public void initialize() { .append('@') .append(versions.getFormatted()) .append('\n')); - context.getSender().sendMessage(packInfo.toString()); + context.sender().sendMessage(packInfo.toString()); })) .command( manager.commandBuilder("packs") - .literal("reload", ArgumentDescription.of("Reload config packs")) + .literal("reload", Description.of("Reload config packs")) .permission("terra.packs.reload") .handler(context -> { - context.getSender().sendMessage("Reloading Terra..."); + context.sender().sendMessage("Reloading Terra..."); logger.info("Reloading Terra..."); if(platform.reload()) { logger.info("Terra reloaded successfully."); - context.getSender().sendMessage("Terra reloaded successfully."); + context.sender().sendMessage("Terra reloaded successfully."); } else { logger.error("Terra failed to reload."); - context.getSender().sendMessage( + context.sender().sendMessage( "Terra failed to reload. See logs for more information."); } })); diff --git a/common/addons/command-profiler/src/main/java/com/dfsek/terra/addons/commands/profiler/ProfilerCommandAddon.java b/common/addons/command-profiler/src/main/java/com/dfsek/terra/addons/commands/profiler/ProfilerCommandAddon.java index 2376c919b..a1559c8c5 100644 --- a/common/addons/command-profiler/src/main/java/com/dfsek/terra/addons/commands/profiler/ProfilerCommandAddon.java +++ b/common/addons/command-profiler/src/main/java/com/dfsek/terra/addons/commands/profiler/ProfilerCommandAddon.java @@ -1,7 +1,7 @@ package com.dfsek.terra.addons.commands.profiler; -import cloud.commandframework.ArgumentDescription; -import cloud.commandframework.CommandManager; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.description.Description; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,24 +33,24 @@ public void initialize() { CommandManager manager = event.getCommandManager(); manager .command( - manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler")) - .literal("start", ArgumentDescription.of("Start profiling"), "st") + manager.commandBuilder("profiler", Description.of("Access the profiler")) + .literal("start", Description.of("Start profiling"), "st") .permission("terra.profiler.start") .handler(context -> { platform.getProfiler().start(); - context.getSender().sendMessage("Profiling started."); + context.sender().sendMessage("Profiling started."); })) .command( - manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler")) - .literal("stop", ArgumentDescription.of("Stop profiling"), "s") + manager.commandBuilder("profiler", Description.of("Access the profiler")) + .literal("stop", Description.of("Stop profiling"), "s") .permission("terra.profiler.stop") .handler(context -> { platform.getProfiler().stop(); - context.getSender().sendMessage("Profiling stopped."); + context.sender().sendMessage("Profiling stopped."); })) .command( - manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler")) - .literal("query", ArgumentDescription.of("Query profiler results"), "q") + manager.commandBuilder("profiler", Description.of("Access the profiler")) + .literal("query", Description.of("Query profiler results"), "q") .permission("terra.profiler.query") .handler(context -> { StringBuilder data = new StringBuilder("Terra Profiler data: \n"); @@ -59,15 +59,15 @@ public void initialize() { .append(timings.toString()) .append('\n')); logger.info(data.toString()); - context.getSender().sendMessage("Profiling data dumped to console."); + context.sender().sendMessage("Profiling data dumped to console."); })) .command( - manager.commandBuilder("profiler", ArgumentDescription.of("Access the profiler")) - .literal("reset", ArgumentDescription.of("Reset the profiler"), "r") + manager.commandBuilder("profiler", Description.of("Access the profiler")) + .literal("reset", Description.of("Reset the profiler"), "r") .permission("terra.profiler.reset") .handler(context -> { platform.getProfiler().reset(); - context.getSender().sendMessage("Profiler reset."); + context.sender().sendMessage("Profiler reset."); })); }); } diff --git a/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java b/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java index 438546137..67e910661 100644 --- a/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java +++ b/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java @@ -1,11 +1,5 @@ package com.dfsek.terra.addons.commands.structure; -import cloud.commandframework.ArgumentDescription; -import cloud.commandframework.CommandManager; -import cloud.commandframework.arguments.standard.EnumArgument; -import cloud.commandframework.arguments.standard.LongArgument; -import cloud.commandframework.context.CommandContext; - import java.util.Random; import com.dfsek.terra.addons.manifest.api.AddonInitializer; @@ -22,6 +16,13 @@ import com.dfsek.terra.api.util.Rotation; import com.dfsek.terra.api.util.reflection.TypeKey; +import org.incendo.cloud.CommandManager; +import org.incendo.cloud.component.DefaultValue; +import org.incendo.cloud.context.CommandContext; +import org.incendo.cloud.description.Description; +import org.incendo.cloud.parser.standard.EnumParser; +import org.incendo.cloud.parser.standard.LongParser; + public class StructureCommandAddon implements AddonInitializer { @Inject @@ -31,7 +32,7 @@ public class StructureCommandAddon implements AddonInitializer { private BaseAddon addon; private static Registry getStructureRegistry(CommandContext sender) { - return sender.getSender().getEntity().orElseThrow().world().getPack().getRegistry(Structure.class); + return sender.sender().getEntity().orElseThrow().world().getPack().getRegistry(Structure.class); } @Override @@ -43,16 +44,16 @@ public void initialize() { CommandManager manager = event.getCommandManager(); manager.command( - manager.commandBuilder("structures", ArgumentDescription.of("Manage or generate structures")) + manager.commandBuilder("structures", Description.of("Manage or generate structures")) .literal("generate") - .argument(RegistryArgument.builder("structure", + .optional(RegistryArgument.builder("structure", StructureCommandAddon::getStructureRegistry, TypeKey.of(Structure.class))) - .argument(LongArgument.optional("seed", 0)) - .argument(EnumArgument.optional(Rotation.class, "rotation", Rotation.NONE)) + .optional("seed", LongParser.longParser(), DefaultValue.constant(0L)) + .optional("rotation", EnumParser.enumParser(Rotation.class), DefaultValue.constant(Rotation.NONE)) .handler(context -> { Structure structure = context.get("structure"); - Entity sender = context.getSender().getEntity().orElseThrow(); + Entity sender = context.sender().getEntity().orElseThrow(); structure.generate( sender.position().toInt(), sender.world(), diff --git a/common/api/build.gradle.kts b/common/api/build.gradle.kts index 4f88c83e3..898f8bdcd 100644 --- a/common/api/build.gradle.kts +++ b/common/api/build.gradle.kts @@ -2,7 +2,7 @@ dependencies { api("ca.solo-studios", "strata", Versions.Libraries.strata) compileOnlyApi("org.slf4j", "slf4j-api", Versions.Libraries.slf4j) testImplementation("org.slf4j", "slf4j-api", Versions.Libraries.slf4j) - api("cloud.commandframework", "cloud-core", Versions.Libraries.cloud) + api("org.incendo", "cloud-core", Versions.Libraries.cloud) api("com.dfsek.tectonic", "common", Versions.Libraries.tectonic) diff --git a/common/api/src/main/java/com/dfsek/terra/api/command/arguments/RegistryArgument.java b/common/api/src/main/java/com/dfsek/terra/api/command/arguments/RegistryArgument.java index e89298751..91d6b56b9 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/command/arguments/RegistryArgument.java +++ b/common/api/src/main/java/com/dfsek/terra/api/command/arguments/RegistryArgument.java @@ -1,18 +1,10 @@ package com.dfsek.terra.api.command.arguments; -import cloud.commandframework.ArgumentDescription; -import cloud.commandframework.arguments.CommandArgument; -import cloud.commandframework.arguments.parser.ArgumentParseResult; -import cloud.commandframework.arguments.parser.ArgumentParser; -import cloud.commandframework.context.CommandContext; import io.leangen.geantyref.TypeToken; import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import java.util.List; import java.util.Optional; -import java.util.Queue; -import java.util.function.BiFunction; +import java.util.concurrent.CompletableFuture; import java.util.function.Function; import java.util.stream.Collectors; @@ -21,40 +13,33 @@ import com.dfsek.terra.api.registry.key.RegistryKey; import com.dfsek.terra.api.util.reflection.TypeKey; +import org.incendo.cloud.component.CommandComponent; +import org.incendo.cloud.component.DefaultValue; +import org.incendo.cloud.context.CommandContext; +import org.incendo.cloud.context.CommandInput; +import org.incendo.cloud.parser.ArgumentParseResult; +import org.incendo.cloud.parser.ArgumentParser; +import org.incendo.cloud.parser.ParserDescriptor; +import org.incendo.cloud.suggestion.Suggestion; +import org.incendo.cloud.suggestion.SuggestionProvider; -public class RegistryArgument extends CommandArgument { - private RegistryArgument( - boolean required, - @NonNull String name, - Function, Registry> registryFunction, - TypeToken typeToken, - @NonNull String defaultValue, - @Nullable BiFunction, String, List> suggestionsProvider, - @NonNull ArgumentDescription description - ) { - super(required, - name, - new RegistryArgumentParser<>(registryFunction), - defaultValue, - typeToken, - suggestionsProvider, - description); - } + +public class RegistryArgument { public static Builder builder(String name, Registry registry) { return new Builder<>(name, registry); } - public static CommandArgument of(String name, Registry registry) { + public static CommandComponent of(String name, Registry registry) { return RegistryArgument.builder(name, registry).build(); } - public static CommandArgument optional(String name, Registry registry) { - return RegistryArgument.builder(name, registry).asOptional().build(); + public static CommandComponent optional(String name, Registry registry) { + return RegistryArgument.builder(name, registry).optional().build(); } - public static CommandArgument optional(String name, Registry registry, String defaultKey) { - return RegistryArgument.builder(name, registry).asOptionalWithDefault(defaultKey).build(); + public static CommandComponent optional(String name, Registry registry, DefaultValue defaultKey) { + return RegistryArgument.builder(name, registry).optional(defaultKey).build(); } @SuppressWarnings("unchecked") @@ -63,49 +48,36 @@ public static Builder builder(String name, Function(name, registryFunction, (TypeToken) TypeToken.get(registryType.getType())); } - public static CommandArgument of(String name, Function, Registry> registryFunction, + public static CommandComponent of(String name, Function, Registry> registryFunction, TypeKey registryType) { return RegistryArgument.builder(name, registryFunction, registryType).build(); } - public static CommandArgument optional(String name, Function, Registry> registryFunction, + public static CommandComponent optional(String name, Function, Registry> registryFunction, TypeKey registryType) { - return RegistryArgument.builder(name, registryFunction, registryType).asOptional().build(); + return RegistryArgument.builder(name, registryFunction, registryType).optional().build(); } - public static CommandArgument optional(String name, Function, Registry> registryFunction, - TypeKey registryType, String defaultKey) { - return RegistryArgument.builder(name, registryFunction, registryType).asOptionalWithDefault(defaultKey).build(); + public static CommandComponent optional(String name, Function, Registry> registryFunction, + TypeKey registryType, DefaultValue defaultKey) { + return RegistryArgument.builder(name, registryFunction, registryType).optional(defaultKey).build(); } - public static final class Builder extends CommandArgument.Builder { - private final Function, Registry> registryFunction; - private final TypeToken typeToken; + public static final class Builder extends CommandComponent.Builder { @SuppressWarnings("unchecked") private Builder(@NonNull String name, Registry registry) { - super((TypeToken) TypeToken.get(registry.getType().getType()), name); - this.registryFunction = commandContext -> registry; - this.typeToken = (TypeToken) TypeToken.get(registry.getType().getType()); + super(); + this.name(name); + this.parser(ParserDescriptor.of( + new RegistryArgumentParser<>(commandContext -> registry), + (TypeToken) TypeToken.get(registry.getType().getType()))); } private Builder(@NonNull String name, Function, Registry> registryFunction, TypeToken typeToken) { - super(typeToken, name); - this.typeToken = typeToken; - this.registryFunction = registryFunction; - } - - @Override - public @NonNull RegistryArgument build() { - return new RegistryArgument<>( - isRequired(), - getName(), - registryFunction, - typeToken, - getDefaultValue(), - getSuggestionsProvider(), - getDefaultDescription() - ); + super(); + this.name(name); + this.parser(ParserDescriptor.of(new RegistryArgumentParser<>(registryFunction), typeToken)); } } @@ -119,12 +91,12 @@ private RegistryArgumentParser(Function, Registry> registry @Override public @NonNull ArgumentParseResult<@NonNull R> parse(@NonNull CommandContext<@NonNull T> commandContext, - @NonNull Queue<@NonNull String> inputQueue) { - String input = inputQueue.remove(); - String next = inputQueue.peek(); - if(next != null && next.equals(":")) { - input += inputQueue.remove(); - input += inputQueue.remove(); + @NonNull CommandInput commandInput) { + String input = commandInput.readString(); + String next = commandInput.peekString(); + if(next.equals(":")) { + input += commandInput.readString(); + input += commandInput.readString(); } Registry registry = registryFunction.apply(commandContext); @@ -146,8 +118,17 @@ private RegistryArgumentParser(Function, Registry> registry } @Override - public @NonNull List<@NonNull String> suggestions(@NonNull CommandContext commandContext, @NonNull String input) { - return registryFunction.apply(commandContext).keys().stream().map(RegistryKey::toString).sorted().collect(Collectors.toList()); + public @NonNull SuggestionProvider suggestionProvider() { + return new SuggestionProvider<>() { + @Override + public @NonNull CompletableFuture> suggestionsFuture( + @NonNull CommandContext context, @NonNull CommandInput input) { + + // TODO: Verify whether this is correct + return CompletableFuture.completedFuture(registryFunction.apply(context).keys().stream().map( + registryKey -> Suggestion.suggestion(registryKey.toString())).sorted().collect(Collectors.toList())); + } + }; } } } diff --git a/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java b/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java index de13f061a..3ad041c9b 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java +++ b/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java @@ -1,10 +1,10 @@ package com.dfsek.terra.api.event.events.platform; -import cloud.commandframework.CommandManager; - import com.dfsek.terra.api.command.CommandSender; import com.dfsek.terra.api.event.events.Event; +import org.incendo.cloud.CommandManager; + public class CommandRegistrationEvent implements Event { private final CommandManager commandManager; diff --git a/platforms/bukkit/common/build.gradle.kts b/platforms/bukkit/common/build.gradle.kts index f47415da4..eaf1956cb 100644 --- a/platforms/bukkit/common/build.gradle.kts +++ b/platforms/bukkit/common/build.gradle.kts @@ -11,5 +11,5 @@ dependencies { shadedApi("com.google.guava", "guava", Versions.Libraries.Internal.guava) - shadedApi("cloud.commandframework", "cloud-paper", Versions.Libraries.cloud) + shadedApi("org.incendo", "cloud-paper", Versions.Libraries.cloudPaper) } diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java index b6c9a6e1d..6ae24afc3 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java @@ -17,15 +17,16 @@ package com.dfsek.terra.bukkit; -import cloud.commandframework.brigadier.CloudBrigadierManager; -import cloud.commandframework.bukkit.CloudBukkitCapabilities; -import cloud.commandframework.execution.CommandExecutionCoordinator; -import cloud.commandframework.paper.PaperCommandManager; import io.papermc.paper.threadedregions.scheduler.AsyncScheduler; import io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler; import org.bukkit.Bukkit; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.java.JavaPlugin; +import org.incendo.cloud.SenderMapper; +import org.incendo.cloud.brigadier.CloudBrigadierManager; +import org.incendo.cloud.bukkit.CloudBukkitCapabilities; +import org.incendo.cloud.execution.ExecutionCoordinator; +import org.incendo.cloud.paper.LegacyPaperCommandManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -71,7 +72,7 @@ public void onEnable() { } try { - PaperCommandManager commandManager = getCommandSenderPaperCommandManager(); + LegacyPaperCommandManager commandManager = getCommandSenderPaperCommandManager(); platform.getEventManager().callEvent(new CommandRegistrationEvent(commandManager)); @@ -91,23 +92,28 @@ public void onEnable() { } @NotNull - private PaperCommandManager getCommandSenderPaperCommandManager() throws Exception { - PaperCommandManager commandManager = new PaperCommandManager<>(this, - CommandExecutionCoordinator.simpleCoordinator(), - BukkitAdapter::adapt, - BukkitAdapter::adapt); - // TODO: Uncomment once Cloud has updated for 1.21 -// if(commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { -// commandManager.registerBrigadier(); -// final CloudBrigadierManager brigManager = commandManager.brigadierManager(); -// if(brigManager != null) { -// brigManager.setNativeNumberSuggestions(false); -// } -// } + private LegacyPaperCommandManager getCommandSenderPaperCommandManager() throws Exception { + // TODO: Update to PaperCommandManager + LegacyPaperCommandManager commandManager = new LegacyPaperCommandManager<>( + this, + ExecutionCoordinator.simpleCoordinator(), + SenderMapper.create( + BukkitAdapter::adapt, + BukkitAdapter::adapt + )); + + if(commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { + commandManager.registerBrigadier(); + final CloudBrigadierManager brigManager = commandManager.brigadierManager(); + if(brigManager != null) { + brigManager.setNativeNumberSuggestions(false); + } + } if(commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { commandManager.registerAsynchronousCompletions(); } + return commandManager; } diff --git a/platforms/fabric/build.gradle.kts b/platforms/fabric/build.gradle.kts index dba268728..58e892e99 100644 --- a/platforms/fabric/build.gradle.kts +++ b/platforms/fabric/build.gradle.kts @@ -10,6 +10,12 @@ architectury { loader("fabric") } +repositories { + maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") { + name = "Sonatype Snapshots" + } +} + dependencies { shadedApi(project(":common:implementation:base")) @@ -26,8 +32,8 @@ dependencies { modImplementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}") - modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) - include("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) + modImplementation("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric) + include("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric) modRuntimeOnly("net.fabricmc.fabric-api", "fabric-api", Versions.Fabric.fabricAPI) } diff --git a/platforms/mixin-lifecycle/build.gradle.kts b/platforms/mixin-lifecycle/build.gradle.kts index a4e700412..824d3cb46 100644 --- a/platforms/mixin-lifecycle/build.gradle.kts +++ b/platforms/mixin-lifecycle/build.gradle.kts @@ -15,7 +15,7 @@ dependencies { minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}") mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2") - modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) { + modImplementation("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric) { exclude("net.fabricmc") exclude("net.fabricmc.fabric-api") } diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java index f20038e5e..781536773 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java @@ -1,8 +1,7 @@ package com.dfsek.terra.lifecycle; -import cloud.commandframework.execution.CommandExecutionCoordinator; -import cloud.commandframework.fabric.FabricServerCommandManager; import net.minecraft.server.command.ServerCommandSource; +import org.incendo.cloud.fabric.FabricServerCommandManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; From 08df5fc2789c71d5134339a6286fcf38fac0e334 Mon Sep 17 00:00:00 2001 From: OakLoaf Date: Mon, 26 Aug 2024 11:24:04 +0100 Subject: [PATCH 27/56] Added 1.21.1 support --- .../main/java/com/dfsek/terra/bukkit/nms/Initializer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java index 1ca6f8c3f..3f7375bc4 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java @@ -15,7 +15,12 @@ public interface Initializer { static boolean init(PlatformImpl platform) { Logger logger = LoggerFactory.getLogger(Initializer.class); try { - Class initializerClass = Class.forName(TERRA_PACKAGE + "." + NMS + ".NMSInitializer"); + String packageVersion = NMS; + if (NMS.equals("v1_21_1")) { + packageVersion = "v1_21"; + } + + Class initializerClass = Class.forName(TERRA_PACKAGE + "." + packageVersion + ".NMSInitializer"); try { Initializer initializer = (Initializer) initializerClass.getConstructor().newInstance(); initializer.initialize(platform); From 3bef7d8572558066c2db8e8b3088d4811db167f5 Mon Sep 17 00:00:00 2001 From: OakLoaf Date: Mon, 26 Aug 2024 12:34:08 +0100 Subject: [PATCH 28/56] Resolved errors when tab completing --- .../main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java index 6ae24afc3..8c392dba1 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java @@ -102,15 +102,13 @@ private LegacyPaperCommandManager getCommandSenderPaperCommandMan BukkitAdapter::adapt )); - if(commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { + if (commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { commandManager.registerBrigadier(); final CloudBrigadierManager brigManager = commandManager.brigadierManager(); if(brigManager != null) { brigManager.setNativeNumberSuggestions(false); } - } - - if(commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { + } else if (commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { commandManager.registerAsynchronousCompletions(); } From 664d1a3191e301975bea973fecaa6105483c15e8 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Tue, 17 Sep 2024 16:34:30 -0600 Subject: [PATCH 29/56] working 1.20.6 --- build.gradle.kts | 3 +- buildSrc/build.gradle.kts | 6 +- buildSrc/src/main/kotlin/DependencyConfig.kt | 3 + .../src/main/kotlin/DistributionConfig.kt | 2 +- buildSrc/src/main/kotlin/Versions.kt | 34 +++++----- gradle/wrapper/gradle-wrapper.jar | Bin 43462 -> 43453 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 2 +- gradlew.bat | 20 +++--- platforms/bukkit/build.gradle.kts | 6 -- platforms/bukkit/nms/v1_21/build.gradle.kts | 4 -- .../bukkit/nms/v1_21/AwfulBukkitHacks.java | 1 + platforms/fabric/build.gradle.kts | 10 --- .../fabric/src/main/resources/fabric.mod.json | 6 +- .../main/resources/terra.fabric.mixins.json | 2 +- .../main/resources/terra.forge.mixins.json | 2 +- .../terra/mod/handle/MinecraftItemHandle.java | 12 +++- .../entity/MobSpawnerBlockEntityMixin.java | 4 +- .../terra/inventory/item/ItemMixin.java | 5 +- .../terra/inventory/item/ItemStackMixin.java | 20 +++++- .../inventory/meta/ItemStackMetaMixin.java | 10 +-- .../terra/world/ChunkRegionMixin.java | 4 +- .../mod/mixin/invoke/FluidBlockInvoker.java | 14 ++++ .../lifecycle/DataPackContentsMixin.java | 11 ++- .../src/main/resources/terra.accesswidener | 2 +- .../main/resources/terra.common.mixins.json | 2 +- platforms/mixin-lifecycle/build.gradle.kts | 4 -- .../terra/lifecycle/LifecycleEntryPoint.java | 7 +- .../terra/lifecycle/LifecyclePlatform.java | 2 +- .../mixin/lifecycle/RegistryLoaderMixin.java | 64 +++++++++++------- .../mixin/lifecycle/SaveLoadingMixin.java | 16 ++--- .../resources/terra.lifecycle.mixins.json | 2 +- .../main/resources/terra.quilt.mixins.json | 2 +- 33 files changed, 167 insertions(+), 119 deletions(-) create mode 100644 platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/invoke/FluidBlockInvoker.java diff --git a/build.gradle.kts b/build.gradle.kts index a8a497a85..67b22ccb5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,6 +15,7 @@ allprojects { tasks.withType().configureEach { options.isFork = true options.isIncremental = true + options.release.set(21) } tasks.withType().configureEach { @@ -44,7 +45,7 @@ afterEvaluate { } project(":platforms:bukkit:common").configureDistribution() forSubProjects(":common:addons") { - apply(plugin = "com.github.johnrengelman.shadow") + apply(plugin = "com.gradleup.shadow") tasks.named("build") { finalizedBy(tasks.named("shadowJar")) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 3d319e8c7..cec2d002d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -16,11 +16,11 @@ repositories { dependencies { //TODO Allow pulling from Versions.kt - implementation("com.github.johnrengelman", "shadow", "8.1.1") - implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.1") + implementation("com.gradleup.shadow", "shadow-gradle-plugin", "8.3.1") + implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.2") implementation("org.ow2.asm", "asm", "9.7") implementation("org.ow2.asm", "asm-tree", "9.7") implementation("com.dfsek.tectonic", "common", "4.2.1") - implementation("org.yaml", "snakeyaml", "2.2") + implementation("org.yaml", "snakeyaml", "2.3") } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/DependencyConfig.kt b/buildSrc/src/main/kotlin/DependencyConfig.kt index 0778808d8..0df8e29f2 100644 --- a/buildSrc/src/main/kotlin/DependencyConfig.kt +++ b/buildSrc/src/main/kotlin/DependencyConfig.kt @@ -48,6 +48,9 @@ fun Project.configureDependencies() { maven("https://jitpack.io") { name = "JitPack" } + maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") { + name = "Sonatype Snapshots" + } } dependencies { diff --git a/buildSrc/src/main/kotlin/DistributionConfig.kt b/buildSrc/src/main/kotlin/DistributionConfig.kt index 80e59104e..12ebd8376 100644 --- a/buildSrc/src/main/kotlin/DistributionConfig.kt +++ b/buildSrc/src/main/kotlin/DistributionConfig.kt @@ -21,7 +21,7 @@ import kotlin.io.path.exists fun Project.configureDistribution() { - apply(plugin = "com.github.johnrengelman.shadow") + apply(plugin = "com.gradleup.shadow") val downloadDefaultPacks = tasks.create("downloadDefaultPacks") { group = "terra" diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index f6e2606e0..d1b7f4024 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -8,23 +8,23 @@ object Versions { const val paralithic = "0.7.1" const val strata = "1.3.2" - const val cloud = "2.0.0-rc.2" - const val cloudPaper = "2.0.0-beta.9" - const val cloudFabric = "2.0.0-beta.7" + const val cloud = "2.0.0" + const val cloudPaper = "2.0.0-beta.10" + const val cloudFabric = "2.0.0-beta.9" const val caffeine = "3.1.8" - const val slf4j = "2.0.13" + const val slf4j = "2.0.16" object Internal { - const val shadow = "8.1.1" + const val shadow = "8.3.1" const val apacheText = "1.12.0" const val apacheIO = "2.16.1" - const val guava = "33.1.0-jre" + const val guava = "33.3.0-jre" const val asm = "9.7" - const val snakeYml = "2.2" + const val snakeYml = "2.3" const val jetBrainsAnnotations = "24.1.0" - const val junit = "5.10.2" + const val junit = "5.11.0" } } @@ -38,14 +38,14 @@ object Versions { // } object Mod { - const val mixin = "0.12.5+mixin.0.8.5" + const val mixin = "0.15.3+mixin.0.8.7" const val minecraft = "1.20.6" const val yarn = "$minecraft+build.1" - const val fabricLoader = "0.15.10" + const val fabricLoader = "0.16.5" - const val architecuryLoom = "1.6.395" - const val architecturyPlugin = "3.4.155" + const val architecuryLoom = "1.7.413" + const val architecturyPlugin = "3.4.159" } // // object Forge { @@ -54,14 +54,14 @@ object Versions { // } object Bukkit { - const val minecraft = "1.21" - const val paperBuild = "$minecraft-R0.1-SNAPSHOT" + const val minecraft = "1.21.1" + const val paperBuild = "$minecraft-R0.1-20240917.151311-80" const val paper = paperBuild const val paperLib = "1.0.8" const val reflectionRemapper = "0.1.1" const val paperDevBundle = paperBuild - const val runPaper = "2.3.0" - const val paperWeight = "1.7.1" + const val runPaper = "2.3.1" + const val paperWeight = "1.7.2" } // @@ -73,6 +73,6 @@ object Versions { // object CLI { const val nbt = "6.1" - const val logback = "1.4.14" + const val logback = "1.5.8" } } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d64cd4917707c1f8861d8cb53dd15194d4248596..e6441136f3d4ba8a0da8d277868979cfbc8ad796 100644 GIT binary patch delta 34118 zcmY(qRX`kF)3u#IAjsf0xCD212@LM;?(PINyAue(f;$XO2=4Cg1P$=#e%|lo zKk1`B>Q#GH)wNd-&cJofz}3=WfYndTeo)CyX{fOHsQjGa<{e=jamMNwjdatD={CN3>GNchOE9OGPIqr)3v>RcKWR3Z zF-guIMjE2UF0Wqk1)21791y#}ciBI*bAenY*BMW_)AeSuM5}vz_~`+1i!Lo?XAEq{TlK5-efNFgHr6o zD>^vB&%3ZGEWMS>`?tu!@66|uiDvS5`?bF=gIq3rkK(j<_TybyoaDHg8;Y#`;>tXI z=tXo~e9{U!*hqTe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%f* z!+NdzG49K(qaO^SBlp@K@D?|^rAq;8{*@kRc4sYSNQmoy7@_RS_ksWl2T_38h2A)# ziU2WXWD03(NqS&Mu*?0-iK8X_Z3w`}c7MPv0qZ7iM|L3xdTnR{y!7{#82$}uJCiGT zqa=8<9L05hu6 z1N+2n7OzT{NEf?gS@eq7@buCDFe9mAxY%THo^b@BHckKK>jg6{@)>n z43cPs%$Qi0iwyZ+{C491>FRu5+6baJ{&XXXC@Sp+b!QE|{7_d?lm5K=B z)myKEcxjFm74+drF|JCYcxdY%ASig#YoRBRUV7An7f-%rqj%PHECbxh#5476cEq@NQL?dI6gUqvS@w zq!WmD(aR0{NxItAZCKDCVw=Zu{9WGDu^i?2g zLerPiOU*HSaXg^3CdOX^F6c9MiHINP339N%)a96`^Z-c#&EogcxMSYo0Cb4{-}q1( zRrJine`P|6WRkm8u4Ja1QRYq$AR>b7tugd#EsT-VmXN-t!TYjZy}i!uKi6$u>EJ?w zvdHZg+hp+5ree?>fdJAX)5#Wtm#2M-{~2jfX2{G`)?D6UD1MevdeeU;;HCi}AtJr( SGW6ptSs!X7{rG*o_g?|vpSEZK diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 381baa9ce..8e876e1c5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionSha256Sum=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a426..b740cf133 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f1..25da30dbd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/platforms/bukkit/build.gradle.kts b/platforms/bukkit/build.gradle.kts index 95924dadd..08a75dc12 100644 --- a/platforms/bukkit/build.gradle.kts +++ b/platforms/bukkit/build.gradle.kts @@ -2,12 +2,6 @@ plugins { id("xyz.jpenilla.run-paper") version Versions.Bukkit.runPaper } -repositories { - maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") { - name = "Sonatype" - } -} - dependencies { shaded(project(":platforms:bukkit:common")) shaded(project(":platforms:bukkit:nms:v1_21", configuration = "reobf")) diff --git a/platforms/bukkit/nms/v1_21/build.gradle.kts b/platforms/bukkit/nms/v1_21/build.gradle.kts index 6881c96ca..d52f1d169 100644 --- a/platforms/bukkit/nms/v1_21/build.gradle.kts +++ b/platforms/bukkit/nms/v1_21/build.gradle.kts @@ -1,9 +1,5 @@ apply(plugin = "io.papermc.paperweight.userdev") -repositories { - maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") -} - dependencies { api(project(":platforms:bukkit:common")) paperDevBundle(Versions.Bukkit.paperDevBundle) diff --git a/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java index d16bbbf30..fc5cc0367 100644 --- a/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java @@ -10,6 +10,7 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.biome.Biome; import org.bukkit.NamespacedKey; import org.slf4j.Logger; diff --git a/platforms/fabric/build.gradle.kts b/platforms/fabric/build.gradle.kts index 58e892e99..631424699 100644 --- a/platforms/fabric/build.gradle.kts +++ b/platforms/fabric/build.gradle.kts @@ -10,12 +10,6 @@ architectury { loader("fabric") } -repositories { - maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") { - name = "Sonatype Snapshots" - } -} - dependencies { shadedApi(project(":common:implementation:base")) @@ -51,10 +45,6 @@ loom { addonDir(project.file("./run/config/Terra/addons"), tasks.named("configureLaunch").get()) tasks { - compileJava { - options.release.set(17) - } - remapJar { dependsOn("installAddons") diff --git a/platforms/fabric/src/main/resources/fabric.mod.json b/platforms/fabric/src/main/resources/fabric.mod.json index 8b67c7b54..bc5319452 100644 --- a/platforms/fabric/src/main/resources/fabric.mod.json +++ b/platforms/fabric/src/main/resources/fabric.mod.json @@ -26,9 +26,9 @@ "terra.common.mixins.json" ], "depends": { - "fabricloader": ">=0.15.1", - "java": ">=17", - "minecraft": ">=1.20.4", + "fabricloader": ">=0.16.5", + "java": ">=21", + "minecraft": ">=1.20.6", "fabric": "*" } } \ No newline at end of file diff --git a/platforms/fabric/src/main/resources/terra.fabric.mixins.json b/platforms/fabric/src/main/resources/terra.fabric.mixins.json index f97889f6d..4778acf1b 100644 --- a/platforms/fabric/src/main/resources/terra.fabric.mixins.json +++ b/platforms/fabric/src/main/resources/terra.fabric.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "com.dfsek.terra.fabric.mixin", - "compatibilityLevel": "JAVA_17", + "compatibilityLevel": "JAVA_21", "mixins": [ ], "client": [ diff --git a/platforms/forge/src/main/resources/terra.forge.mixins.json b/platforms/forge/src/main/resources/terra.forge.mixins.json index 25c1c470e..095ea9234 100644 --- a/platforms/forge/src/main/resources/terra.forge.mixins.json +++ b/platforms/forge/src/main/resources/terra.forge.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "com.dfsek.terra.forge.mixin", - "compatibilityLevel": "JAVA_17", + "compatibilityLevel": "JAVA_21", "mixins": [ "lifecycle.NoiseConfigMixin" ], diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java index 541e764ab..f260ba3f2 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java @@ -25,10 +25,13 @@ import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryWrapper; +import net.minecraft.registry.RegistryWrapper.Impl; import net.minecraft.util.Identifier; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; import com.dfsek.terra.api.handle.ItemHandle; import com.dfsek.terra.api.inventory.Item; @@ -43,8 +46,13 @@ public Item createItem(String data) { try { return (Item) new ItemStackArgumentType(new CommandRegistryAccess() { @Override - public RegistryWrapper createWrapper(RegistryKey> registryRef) { - return CommonPlatform.get().getServer().getRegistryManager().getWrapperOrThrow(registryRef); + public Stream>> streamAllRegistryKeys() { + return CommonPlatform.get().getServer().getRegistryManager().streamAllRegistryKeys(); + } + + @Override + public Optional> getOptionalWrapper(RegistryKey> registryRef) { + return Optional.of(CommonPlatform.get().getServer().getRegistryManager().getWrapperOrThrow(registryRef)); } }).parse(new StringReader(data)).getItem(); } catch(CommandSyntaxException e) { diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java index 2ec582417..ccc8b738a 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java @@ -50,7 +50,7 @@ private MobSpawnerBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockS public abstract MobSpawnerLogic getLogic(); @Shadow - public abstract void setEntityType(net.minecraft.entity.EntityType entityType, Random random); + public abstract void method_46408(net.minecraft.entity.EntityType entityType, Random random); public EntityType terra$getSpawnedType() { return (EntityType) Registries.ENTITY_TYPE.get( @@ -64,7 +64,7 @@ private MobSpawnerBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockS } else { rand = Random.create(); } - setEntityType((net.minecraft.entity.EntityType) creatureType, rand); + method_46408((net.minecraft.entity.EntityType) creatureType, rand); } public int terra$getDelay() { diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemMixin.java index 78593ecb1..e8832c214 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemMixin.java @@ -30,7 +30,7 @@ @Implements(@Interface(iface = com.dfsek.terra.api.inventory.Item.class, prefix = "terra$")) public abstract class ItemMixin { @Shadow - public abstract int getMaxDamage(); + public abstract net.minecraft.item.ItemStack getDefaultStack(); @SuppressWarnings("ConstantConditions") public ItemStack terra$newItemStack(int amount) { @@ -38,6 +38,7 @@ public abstract class ItemMixin { } public double terra$getMaxDurability() { - return getMaxDamage(); + //TODO verify this is correct + return getDefaultStack().getMaxDamage(); } } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java index 089a6db1d..155836837 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java @@ -17,9 +17,15 @@ package com.dfsek.terra.mod.mixin.implementations.terra.inventory.item; +import net.minecraft.component.Component; +import net.minecraft.component.ComponentChanges; +import net.minecraft.component.ComponentMap; +import net.minecraft.component.ComponentMapImpl; +import net.minecraft.component.DataComponentType; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Implements; import org.spongepowered.asm.mixin.Interface; import org.spongepowered.asm.mixin.Intrinsic; @@ -46,7 +52,11 @@ public abstract class ItemStackMixin { public abstract boolean isDamageable(); @Shadow - public abstract void setNbt(@Nullable NbtCompound tag); + public abstract ComponentMap getComponents(); + + @Shadow + @Final + private ComponentMapImpl components; public int terra$getAmount() { return getCount(); @@ -66,7 +76,13 @@ public abstract class ItemStackMixin { @SuppressWarnings("ConstantConditions") public void terra$setItemMeta(ItemMeta meta) { - setNbt(((ItemStack) (Object) meta).getNbt()); + ComponentChanges.Builder builder = ComponentChanges.builder(); + this.getComponents().getTypes().forEach(builder::remove); + + ComponentMap components = ((ItemStack) (Object) meta).getComponents(); + components.forEach(builder::add); + + this.components.applyChanges(builder.build()); } @Intrinsic diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java index a6307b02c..5617f494c 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java @@ -17,6 +17,7 @@ package com.dfsek.terra.mod.mixin.implementations.terra.inventory.meta; +import net.minecraft.component.type.ItemEnchantmentsComponent; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtList; @@ -42,7 +43,7 @@ public abstract class ItemStackMetaMixin { public abstract boolean hasEnchantments(); @Shadow - public abstract NbtList getEnchantments(); + public abstract ItemEnchantmentsComponent getEnchantments(); @Shadow public abstract void addEnchantment(net.minecraft.enchantment.Enchantment enchantment, int level); @@ -56,9 +57,10 @@ public abstract class ItemStackMetaMixin { if(!hasEnchantments()) return Collections.emptyMap(); Map map = new HashMap<>(); - getEnchantments().forEach(enchantment -> { - NbtCompound eTag = (NbtCompound) enchantment; - map.put((Enchantment) Registries.ENCHANTMENT.get(eTag.getInt("id")), eTag.getInt("lvl")); + ItemEnchantmentsComponent enchantments = getEnchantments(); + enchantments.getEnchantments().forEach(enchantment -> { + net.minecraft.enchantment.Enchantment enchantmentValue = enchantment.value(); + map.put((Enchantment) enchantmentValue, enchantments.getLevel(enchantmentValue)); }); return map; } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java index 82080579b..1a0e9e0df 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java @@ -17,6 +17,8 @@ package com.dfsek.terra.mod.mixin.implementations.terra.world; +import com.dfsek.terra.mod.mixin.invoke.FluidBlockInvoker; + import net.minecraft.block.FluidBlock; import net.minecraft.fluid.Fluid; import net.minecraft.util.math.BlockPos; @@ -88,7 +90,7 @@ public void injectConstructor(net.minecraft.server.world.ServerWorld world, List ((ChunkRegion) (Object) this).setBlockState(pos, (net.minecraft.block.BlockState) data, physics ? 3 : 1042); if(physics && ((net.minecraft.block.BlockState) data).getBlock() instanceof FluidBlock) { fluidTickScheduler.scheduleTick( - OrderedTick.create(((FluidBlock) ((net.minecraft.block.BlockState) data).getBlock()).getFluidState( + OrderedTick.create((((FluidBlockInvoker) ((net.minecraft.block.BlockState) data).getBlock())).invokeGetFluidState( (net.minecraft.block.BlockState) data).getFluid(), pos)); } } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/invoke/FluidBlockInvoker.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/invoke/FluidBlockInvoker.java new file mode 100644 index 000000000..a6b50409c --- /dev/null +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/invoke/FluidBlockInvoker.java @@ -0,0 +1,14 @@ +package com.dfsek.terra.mod.mixin.invoke; + +import net.minecraft.block.BlockState; +import net.minecraft.block.FluidBlock; +import net.minecraft.fluid.FluidState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + + +@Mixin(FluidBlock.class) +public interface FluidBlockInvoker { + @Invoker("getFluidState") + public FluidState invokeGetFluidState(BlockState state); +} diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java index 48ea98519..305f7f024 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java @@ -3,9 +3,12 @@ import net.minecraft.registry.DynamicRegistryManager; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.ReloadableRegistries; import net.minecraft.server.DataPackContents; import net.minecraft.world.biome.Biome; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -16,11 +19,15 @@ @Mixin(DataPackContents.class) public class DataPackContentsMixin { + @Shadow + @Final + private ReloadableRegistries.Lookup reloadableRegistries; /* * #refresh populates all tags in the registries */ - @Inject(method = "refresh(Lnet/minecraft/registry/DynamicRegistryManager;)V", at = @At("RETURN")) - private void injectReload(DynamicRegistryManager dynamicRegistryManager, CallbackInfo ci) { + @Inject(method = "refresh()V", at = @At("RETURN")) + private void injectReload(CallbackInfo ci) { + DynamicRegistryManager.Immutable dynamicRegistryManager = this.reloadableRegistries.getRegistryManager(); TagUtil.registerWorldPresetTags(dynamicRegistryManager.get(RegistryKeys.WORLD_PRESET)); Registry biomeRegistry = dynamicRegistryManager.get(RegistryKeys.BIOME); diff --git a/platforms/mixin-common/src/main/resources/terra.accesswidener b/platforms/mixin-common/src/main/resources/terra.accesswidener index 50cba4f7d..46f1b986e 100644 --- a/platforms/mixin-common/src/main/resources/terra.accesswidener +++ b/platforms/mixin-common/src/main/resources/terra.accesswidener @@ -1,4 +1,4 @@ accessWidener v1 named accessible class net/minecraft/world/biome/Biome$Weather accessible class net/minecraft/world/gen/WorldPresets$Registrar -accessible method net/minecraft/block/FluidBlock getFluidState (Lnet/minecraft/block/BlockState;)Lnet/minecraft/fluid/FluidState +accessible class net/minecraft/registry/RegistryLoader$Loader \ No newline at end of file diff --git a/platforms/mixin-common/src/main/resources/terra.common.mixins.json b/platforms/mixin-common/src/main/resources/terra.common.mixins.json index d4402241c..f8d0718e4 100644 --- a/platforms/mixin-common/src/main/resources/terra.common.mixins.json +++ b/platforms/mixin-common/src/main/resources/terra.common.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "com.dfsek.terra.mod.mixin", - "compatibilityLevel": "JAVA_17", + "compatibilityLevel": "JAVA_21", "mixins": [ "access.BiomeAccessor", "access.MobSpawnerLogicAccessor", diff --git a/platforms/mixin-lifecycle/build.gradle.kts b/platforms/mixin-lifecycle/build.gradle.kts index 824d3cb46..b7d209b7f 100644 --- a/platforms/mixin-lifecycle/build.gradle.kts +++ b/platforms/mixin-lifecycle/build.gradle.kts @@ -30,10 +30,6 @@ loom { } tasks { - compileJava { - options.release.set(17) - } - remapJar { inputFile.set(shadowJar.get().archiveFile) } diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java index 781536773..65d86febf 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java @@ -1,6 +1,8 @@ package com.dfsek.terra.lifecycle; import net.minecraft.server.command.ServerCommandSource; +import org.incendo.cloud.SenderMapper; +import org.incendo.cloud.execution.ExecutionCoordinator; import org.incendo.cloud.fabric.FabricServerCommandManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -16,9 +18,10 @@ public static void initialize(String modName, LifecyclePlatform platform) { logger.info("Initializing Terra {} mod...", modName); FabricServerCommandManager manager = new FabricServerCommandManager<>( - CommandExecutionCoordinator.simpleCoordinator(), + ExecutionCoordinator.simpleCoordinator(), + SenderMapper.create( serverCommandSource -> (CommandSender) serverCommandSource, - commandSender -> (ServerCommandSource) commandSender + commandSender -> (ServerCommandSource) commandSender) ); diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecyclePlatform.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecyclePlatform.java index be845eb19..41a57b448 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecyclePlatform.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecyclePlatform.java @@ -69,7 +69,7 @@ public boolean reload() { if(server != null) { BiomeUtil.registerBiomes(server.getRegistryManager().get(RegistryKeys.BIOME)); - server.reloadResources(server.getDataPackManager().getNames()).exceptionally(throwable -> { + server.reloadResources(server.getDataPackManager().getEnabledIds()).exceptionally(throwable -> { LOGGER.warn("Failed to execute reload", throwable); return null; }).join(); diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java index 052598ac2..b54ee9a02 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java @@ -1,11 +1,14 @@ package com.dfsek.terra.lifecycle.mixin.lifecycle; import com.mojang.datafixers.util.Pair; +import net.minecraft.registry.DynamicRegistryManager; +import net.minecraft.registry.DynamicRegistryManager.Immutable; import net.minecraft.registry.MutableRegistry; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.RegistryLoader; +import net.minecraft.registry.RegistryLoader.Loader; import net.minecraft.world.biome.source.MultiNoiseBiomeSourceParameterList; import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.gen.WorldPreset; @@ -14,7 +17,9 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import java.util.List; @@ -25,48 +30,61 @@ import com.dfsek.terra.lifecycle.util.LifecycleUtil; import com.dfsek.terra.lifecycle.util.RegistryHack; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + @Mixin(RegistryLoader.class) public class RegistryLoaderMixin { + private static boolean initialized = false; @Shadow @Final private static Logger LOGGER; - +// @Inject( +// method = "load(Lnet/minecraft/registry/RegistryLoader$RegistryLoadable;Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;", +// at = @At( +// value = "INVOKE", +// target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", +// ordinal = 1 // we want right after the first forEach +// ) +// ) +// private static void grabRegiestry(RegistryLoader.RegistryLoadable loadable, DynamicRegistryManager baseRegistryManager, +// List> entries, CallbackInfoReturnable cir) { +// entries.forEach((loader) -> { +// Registry registry = loader.registry(); +// } @Redirect( - method = "load(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)" + - "Lnet/minecraft/registry/DynamicRegistryManager$Immutable;", + method = "load(Lnet/minecraft/registry/RegistryLoader$RegistryLoadable;Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;", at = @At( value = "INVOKE", target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", ordinal = 1 // we want right after the first forEach ) ) - private static void grabManager(List, Object>> instance, Consumer, Object>> consumer) { - instance.forEach(mutableRegistryObjectPair -> LOGGER.debug("{}: {} entries", - mutableRegistryObjectPair.getFirst().toString(), - mutableRegistryObjectPair.getFirst().size()) - ); - extractRegistry(instance, RegistryKeys.BIOME).ifPresent( - biomes -> { // this redirect triggers twice, second time only with dimension registry. don't try extraction second time - MutableRegistry dimensionTypes = extractRegistry(instance, RegistryKeys.DIMENSION_TYPE).orElseThrow(); - MutableRegistry worldPresets = extractRegistry(instance, RegistryKeys.WORLD_PRESET).orElseThrow(); - MutableRegistry chunkGeneratorSettings = extractRegistry(instance, - RegistryKeys.CHUNK_GENERATOR_SETTINGS).orElseThrow(); - MutableRegistry multiNoiseBiomeSourceParameterLists = extractRegistry(instance, - RegistryKeys.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST).orElseThrow(); + private static void grabManager(List> instance, Consumer> consumer) { + if (!initialized) { + extractRegistry(instance, RegistryKeys.BIOME).ifPresent( + biomes -> { // this redirect triggers twice, second time only with dimension registry. don't try extraction second time + MutableRegistry dimensionTypes = extractRegistry(instance, RegistryKeys.DIMENSION_TYPE).orElseThrow(); + MutableRegistry worldPresets = extractRegistry(instance, RegistryKeys.WORLD_PRESET).orElseThrow(); + MutableRegistry chunkGeneratorSettings = extractRegistry(instance, + RegistryKeys.CHUNK_GENERATOR_SETTINGS).orElseThrow(); + MutableRegistry multiNoiseBiomeSourceParameterLists = extractRegistry(instance, + RegistryKeys.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST).orElseThrow(); - LifecyclePlatform.setRegistries(biomes, dimensionTypes, chunkGeneratorSettings, multiNoiseBiomeSourceParameterLists); - LifecycleUtil.initialize(biomes, worldPresets); - }); + LifecyclePlatform.setRegistries(biomes, dimensionTypes, chunkGeneratorSettings, multiNoiseBiomeSourceParameterLists); + LifecycleUtil.initialize(biomes, worldPresets); + }); + initialized = true; + } instance.forEach(consumer); } + @Unique @SuppressWarnings("unchecked") - private static Optional> extractRegistry(List, Object>> instance, + private static Optional> extractRegistry(List> instance, RegistryKey> key) { List> matches = instance - .stream() - .map(Pair::getFirst) + .stream().map(RegistryLoader.Loader::registry) .filter(r -> r.getKey().equals(key)) .toList(); if(matches.size() > 1) { @@ -74,7 +92,7 @@ private static Optional> extractRegistry(List registry = (MutableRegistry) matches.get(0); + MutableRegistry registry = (MutableRegistry) matches.getFirst(); ((RegistryHack) registry).terra_bind(); return Optional.of(registry); } diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/SaveLoadingMixin.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/SaveLoadingMixin.java index 6f373130f..0bf675fc2 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/SaveLoadingMixin.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/SaveLoadingMixin.java @@ -13,18 +13,14 @@ @Mixin(SaveLoading.class) public class SaveLoadingMixin { @ModifyArg( - method = "method_42097(Lnet/minecraft/registry/DynamicRegistryManager$Immutable;" + - "Lnet/minecraft/server/SaveLoading$SaveApplierFactory;Lnet/minecraft/resource/LifecycledResourceManager;" + - "Lnet/minecraft/registry/CombinedDynamicRegistries;Lnet/minecraft/server/SaveLoading$LoadContext;" + - "Lnet/minecraft/server/DataPackContents;)Ljava/lang/Object;", + method = "load(Lnet/minecraft/server/SaveLoading$ServerConfig;Lnet/minecraft/server/SaveLoading$LoadContextSupplier;Lnet/minecraft/server/SaveLoading$SaveApplierFactory;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/DataPackContents;refresh(Lnet/minecraft/registry/DynamicRegistryManager;)V" - ), - index = 0 + target = "Lnet/minecraft/registry/RegistryLoader;loadFromResource(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;" ), + index = 1 ) - private static DynamicRegistryManager grabManager(DynamicRegistryManager in) { - MinecraftUtil.registerFlora(in.get(RegistryKeys.BIOME)); - return in; + private static DynamicRegistryManager grabManager(DynamicRegistryManager registryManager) { + MinecraftUtil.registerFlora(registryManager.get(RegistryKeys.BIOME)); + return registryManager; } } diff --git a/platforms/mixin-lifecycle/src/main/resources/terra.lifecycle.mixins.json b/platforms/mixin-lifecycle/src/main/resources/terra.lifecycle.mixins.json index 33695db0e..2e4708bd4 100644 --- a/platforms/mixin-lifecycle/src/main/resources/terra.lifecycle.mixins.json +++ b/platforms/mixin-lifecycle/src/main/resources/terra.lifecycle.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "com.dfsek.terra.lifecycle.mixin", - "compatibilityLevel": "JAVA_17", + "compatibilityLevel": "JAVA_21", "mixins": [ "NoiseConfigMixin", "RegistryEntryReferenceInvoker", diff --git a/platforms/quilt/src/main/resources/terra.quilt.mixins.json b/platforms/quilt/src/main/resources/terra.quilt.mixins.json index 91f51b344..84ca8264a 100644 --- a/platforms/quilt/src/main/resources/terra.quilt.mixins.json +++ b/platforms/quilt/src/main/resources/terra.quilt.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "com.dfsek.terra.quilt.mixin", - "compatibilityLevel": "JAVA_17", + "compatibilityLevel": "JAVA_21", "mixins": [ ], "client": [ From 15a298304e72938ddb5ce7017a47cb62393a7b1a Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Tue, 17 Sep 2024 17:40:56 -0600 Subject: [PATCH 30/56] working 1.21.1 --- buildSrc/src/main/kotlin/Versions.kt | 6 +++--- .../main/java/com/dfsek/terra/mod/ModPlatform.java | 5 +++++ .../generation/MinecraftChunkGeneratorWrapper.java | 5 ++--- .../terra/mod/handle/MinecraftItemHandle.java | 4 ++-- .../block/entity/MobSpawnerBlockEntityMixin.java | 6 +++--- .../implementations/terra/entity/EntityMixin.java | 4 ++-- .../terra/inventory/item/ItemStackMixin.java | 1 - .../terra/inventory/meta/EnchantmentMixin.java | 14 +++++++++++--- .../terra/inventory/meta/ItemStackMetaMixin.java | 9 +++++---- .../terra/world/ChunkRegionMixin.java | 9 +++++---- .../java/com/dfsek/terra/mod/util/PresetUtil.java | 2 +- .../dfsek/terra/lifecycle/LifecyclePlatform.java | 11 ++++++++++- .../mixin/lifecycle/RegistryLoaderMixin.java | 4 +++- .../com/dfsek/terra/lifecycle/util/BiomeUtil.java | 2 +- .../dfsek/terra/lifecycle/util/RegistryUtil.java | 4 ++-- 15 files changed, 55 insertions(+), 31 deletions(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index d1b7f4024..1e48e716a 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -29,7 +29,7 @@ object Versions { } object Fabric { - const val fabricAPI = "0.97.8+${Mod.minecraft}" + const val fabricAPI = "0.104.0+${Mod.minecraft}" } // // object Quilt { @@ -40,8 +40,8 @@ object Versions { object Mod { const val mixin = "0.15.3+mixin.0.8.7" - const val minecraft = "1.20.6" - const val yarn = "$minecraft+build.1" + const val minecraft = "1.21.1" + const val yarn = "$minecraft+build.3" const val fabricLoader = "0.16.5" const val architecuryLoom = "1.7.413" diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java index d6d35508a..308f7913c 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java @@ -3,6 +3,7 @@ import com.dfsek.tectonic.api.TypeRegistry; import com.dfsek.tectonic.api.depth.DepthTracker; import com.dfsek.tectonic.api.exception.LoadException; +import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnGroup; import net.minecraft.registry.Registry; @@ -116,6 +117,8 @@ protected Iterable platformAddon() { public abstract Registry multiNoiseBiomeSourceParameterListRegistry(); + public abstract Registry enchantmentRegistry(); + @Override public @NotNull WorldHandle getWorldHandle() { return worldHandle; @@ -125,4 +128,6 @@ protected Iterable platformAddon() { public @NotNull ItemHandle getItemHandle() { return itemHandle; } + + } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java index 8ac07a688..c73ad3f3b 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java @@ -111,10 +111,9 @@ public int getWorldHeight() { return settings.value().generationShapeConfig().height(); } - @Override - public CompletableFuture populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig, - StructureAccessor structureAccessor, Chunk chunk) { + public CompletableFuture populateNoise(Blender blender, NoiseConfig noiseConfig, StructureAccessor structureAccessor, + Chunk chunk) { return CompletableFuture.supplyAsync(() -> { ProtoWorld world = (ProtoWorld) ((StructureAccessorAccessor) structureAccessor).getWorld(); BiomeProvider biomeProvider = pack.getBiomeProvider(); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java index f260ba3f2..e9a5f5ae4 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java @@ -62,11 +62,11 @@ public Optional> getOptionalWrapper(RegistryKey getEnchantments() { - return Registries.ENCHANTMENT.stream().map(enchantment -> (Enchantment) enchantment).collect(Collectors.toSet()); + return CommonPlatform.get().enchantmentRegistry().stream().map(enchantment -> (Enchantment) (Object) enchantment).collect(Collectors.toSet()); } } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java index ccc8b738a..caf918d1d 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java @@ -48,9 +48,9 @@ private MobSpawnerBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockS @Shadow public abstract MobSpawnerLogic getLogic(); - +//method_46408 @Shadow - public abstract void method_46408(net.minecraft.entity.EntityType entityType, Random random); + public abstract void setEntityType(net.minecraft.entity.EntityType entityType, Random random); public EntityType terra$getSpawnedType() { return (EntityType) Registries.ENTITY_TYPE.get( @@ -64,7 +64,7 @@ private MobSpawnerBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockS } else { rand = Random.create(); } - method_46408((net.minecraft.entity.EntityType) creatureType, rand); + setEntityType((net.minecraft.entity.EntityType) creatureType, rand); } public int terra$getDelay() { diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/entity/EntityMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/entity/EntityMixin.java index 3225cd4a6..0b2f47017 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/entity/EntityMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/entity/EntityMixin.java @@ -39,14 +39,14 @@ public abstract class EntityMixin { private BlockPos blockPos; @Shadow - public abstract void teleport(double destX, double destY, double destZ); + public abstract void updatePosition(double destX, double destY, double destZ); public Vector3 terra$position() { return MinecraftAdapter.adapt(blockPos); } public void terra$position(Vector3 location) { - teleport(location.getX(), location.getY(), location.getZ()); + updatePosition(location.getX(), location.getY(), location.getZ()); } public ServerWorld terra$world() { diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java index 155836837..70177be1f 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java @@ -21,7 +21,6 @@ import net.minecraft.component.ComponentChanges; import net.minecraft.component.ComponentMap; import net.minecraft.component.ComponentMapImpl; -import net.minecraft.component.DataComponentType; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import org.jetbrains.annotations.Nullable; diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/EnchantmentMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/EnchantmentMixin.java index 24b096c85..dd7cfbce0 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/EnchantmentMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/EnchantmentMixin.java @@ -17,8 +17,13 @@ package com.dfsek.terra.mod.mixin.implementations.terra.inventory.meta; +import com.dfsek.terra.mod.CommonPlatform; + import net.minecraft.enchantment.Enchantment; import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.entry.RegistryEntryList; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Implements; import org.spongepowered.asm.mixin.Interface; import org.spongepowered.asm.mixin.Mixin; @@ -28,6 +33,8 @@ import com.dfsek.terra.api.inventory.ItemStack; +import static net.minecraft.enchantment.Enchantment.canBeCombined; + @Mixin(Enchantment.class) @Implements(@Interface(iface = com.dfsek.terra.api.inventory.item.Enchantment.class, prefix = "terra$")) @@ -36,7 +43,8 @@ public abstract class EnchantmentMixin { public abstract boolean isAcceptableItem(net.minecraft.item.ItemStack stack); @Shadow - public abstract boolean canCombine(Enchantment other); + @Final + private RegistryEntryList exclusiveSet; @SuppressWarnings("ConstantConditions") public boolean terra$canEnchantItem(ItemStack itemStack) { @@ -44,10 +52,10 @@ public abstract class EnchantmentMixin { } public boolean terra$conflictsWith(com.dfsek.terra.api.inventory.item.Enchantment other) { - return !canCombine((Enchantment) other); + return canBeCombined(RegistryEntry.of((Enchantment) (Object) this), RegistryEntry.of((Enchantment) (Object) other)); } public String terra$getID() { - return Objects.requireNonNull(Registries.ENCHANTMENT.getId((Enchantment) (Object) this)).toString(); + return Objects.requireNonNull(CommonPlatform.get().enchantmentRegistry().getId((Enchantment) (Object) this)).toString(); } } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java index 5617f494c..a3bcf54df 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java @@ -22,6 +22,7 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtList; import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; import org.spongepowered.asm.mixin.Implements; import org.spongepowered.asm.mixin.Interface; import org.spongepowered.asm.mixin.Intrinsic; @@ -46,10 +47,10 @@ public abstract class ItemStackMetaMixin { public abstract ItemEnchantmentsComponent getEnchantments(); @Shadow - public abstract void addEnchantment(net.minecraft.enchantment.Enchantment enchantment, int level); + public abstract void addEnchantment(RegistryEntry enchantment, int level); - public void terra$addEnchantment(Enchantment enchantment, int level) { - addEnchantment((net.minecraft.enchantment.Enchantment) enchantment, level); + public void terra$addEnchantment(Enchantment enchantment, int level) { ; + addEnchantment(RegistryEntry.of((net.minecraft.enchantment.Enchantment) (Object) enchantment), level); } @Intrinsic(displace = true) @@ -60,7 +61,7 @@ public abstract class ItemStackMetaMixin { ItemEnchantmentsComponent enchantments = getEnchantments(); enchantments.getEnchantments().forEach(enchantment -> { net.minecraft.enchantment.Enchantment enchantmentValue = enchantment.value(); - map.put((Enchantment) enchantmentValue, enchantments.getLevel(enchantmentValue)); + map.put((Enchantment) (Object) enchantmentValue, enchantments.getLevel(RegistryEntry.of(enchantmentValue))); }); return map; } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java index 1a0e9e0df..7ae5441d0 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java @@ -21,10 +21,12 @@ import net.minecraft.block.FluidBlock; import net.minecraft.fluid.Fluid; +import net.minecraft.util.collection.BoundedRegionArray; import net.minecraft.util.math.BlockPos; import net.minecraft.world.ChunkRegion; import net.minecraft.world.WorldAccess; import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.ChunkGenerationStep; import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.tick.MultiTickScheduler; import net.minecraft.world.tick.OrderedTick; @@ -76,10 +78,9 @@ public abstract class ChunkRegionMixin { @Inject(at = @At("RETURN"), - method = "(Lnet/minecraft/server/world/ServerWorld;Ljava/util/List;Lnet/minecraft/world/chunk/ChunkStatus;I)V") - public void injectConstructor(net.minecraft.server.world.ServerWorld world, List list, - ChunkStatus chunkStatus, int i, - CallbackInfo ci) { + method = "(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/collection/BoundedRegionArray;Lnet/minecraft/world/chunk/ChunkGenerationStep;Lnet/minecraft/world/chunk/Chunk;)V") + public void injectConstructor(net.minecraft.server.world.ServerWorld world, BoundedRegionArray chunks, + ChunkGenerationStep generationStep, Chunk centerPos, CallbackInfo ci) { this.terra$config = ((ServerWorld) world).getPack(); } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java index 1c8627364..de147c509 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java @@ -45,7 +45,7 @@ public static Pair createDefault(ConfigPack pack, ModPl .orElseThrow(); - Identifier generatorID = Identifier.of("terra", pack.getID().toLowerCase(Locale.ROOT) + "/" + pack.getNamespace().toLowerCase( + Identifier generatorID = Identifier.tryParse("terra:" + pack.getID().toLowerCase(Locale.ROOT) + "/" + pack.getNamespace().toLowerCase( Locale.ROOT)); PRESETS.add(generatorID); diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecyclePlatform.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecyclePlatform.java index 41a57b448..391842311 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecyclePlatform.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecyclePlatform.java @@ -4,6 +4,7 @@ import ca.solostudios.strata.parser.tokenizer.ParseException; import ca.solostudios.strata.version.Version; import net.minecraft.MinecraftVersion; +import net.minecraft.enchantment.Enchantment; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKeys; import net.minecraft.server.MinecraftServer; @@ -34,6 +35,7 @@ public abstract class LifecyclePlatform extends ModPlatform { private static final AtomicReference> DIMENSIONS = new AtomicReference<>(); private static final AtomicReference> SETTINGS = new AtomicReference<>(); private static final AtomicReference> NOISE = new AtomicReference<>(); + private static final AtomicReference> ENCHANTMENT = new AtomicReference<>(); private static MinecraftServer server; public LifecyclePlatform() { @@ -44,11 +46,13 @@ public LifecyclePlatform() { public static void setRegistries(Registry biomeRegistry, Registry dimensionTypeRegistry, Registry chunkGeneratorSettingsRegistry, - Registry multiNoiseBiomeSourceParameterListRegistry) { + Registry multiNoiseBiomeSourceParameterListRegistry, + Registry enchantmentRegistry) { BIOMES.set(biomeRegistry); DIMENSIONS.set(dimensionTypeRegistry); SETTINGS.set(chunkGeneratorSettingsRegistry); NOISE.set(multiNoiseBiomeSourceParameterListRegistry); + ENCHANTMENT.set(enchantmentRegistry); } @Override @@ -141,5 +145,10 @@ public Registry multiNoiseBiomeSourceParamet return NOISE.get(); } + @Override + public Registry enchantmentRegistry() { + return ENCHANTMENT.get(); + } + protected abstract Collection getPlatformMods(); } diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java index b54ee9a02..a5d2a9bde 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java @@ -1,6 +1,7 @@ package com.dfsek.terra.lifecycle.mixin.lifecycle; import com.mojang.datafixers.util.Pair; +import net.minecraft.enchantment.Enchantment; import net.minecraft.registry.DynamicRegistryManager; import net.minecraft.registry.DynamicRegistryManager.Immutable; import net.minecraft.registry.MutableRegistry; @@ -70,8 +71,9 @@ private static void grabManager(List> instance, Consume RegistryKeys.CHUNK_GENERATOR_SETTINGS).orElseThrow(); MutableRegistry multiNoiseBiomeSourceParameterLists = extractRegistry(instance, RegistryKeys.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST).orElseThrow(); + MutableRegistry enchantments = extractRegistry(instance, RegistryKeys.ENCHANTMENT).orElseThrow(); - LifecyclePlatform.setRegistries(biomes, dimensionTypes, chunkGeneratorSettings, multiNoiseBiomeSourceParameterLists); + LifecyclePlatform.setRegistries(biomes, dimensionTypes, chunkGeneratorSettings, multiNoiseBiomeSourceParameterLists, enchantments); LifecycleUtil.initialize(biomes, worldPresets); }); initialized = true; diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/BiomeUtil.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/BiomeUtil.java index 5d5ab11c0..b32e12935 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/BiomeUtil.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/BiomeUtil.java @@ -58,7 +58,7 @@ private static void registerBiome(Biome biome, ConfigPack pack, net.minecraft.world.biome.Biome minecraftBiome = MinecraftUtil.createBiome(biome, Objects.requireNonNull(registry.get(vanilla)), vanillaBiomeProperties); - Identifier identifier = new Identifier("terra", MinecraftUtil.createBiomeID(pack, id)); + Identifier identifier = Identifier.of("terra", MinecraftUtil.createBiomeID(pack, id)); if(registry.containsId(identifier)) { ((ProtoPlatformBiome) biome.getPlatformBiome()).setDelegate(MinecraftUtil.getEntry(registry, identifier) diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/RegistryUtil.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/RegistryUtil.java index 03f0639c7..69bc2ce21 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/RegistryUtil.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/RegistryUtil.java @@ -13,7 +13,7 @@ private RegistryUtil() { } public static void register() { - Registry.register(Registries.CHUNK_GENERATOR, new Identifier("terra:terra"), Codecs.MINECRAFT_CHUNK_GENERATOR_WRAPPER); - Registry.register(Registries.BIOME_SOURCE, new Identifier("terra:terra"), Codecs.TERRA_BIOME_SOURCE); + Registry.register(Registries.CHUNK_GENERATOR, Identifier.of("terra:terra"), Codecs.MINECRAFT_CHUNK_GENERATOR_WRAPPER); + Registry.register(Registries.BIOME_SOURCE, Identifier.of("terra:terra"), Codecs.TERRA_BIOME_SOURCE); } } From b63f5f4a8fd72587aa0e450a7823fc1b0ffe65d8 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Wed, 18 Sep 2024 12:43:41 -0600 Subject: [PATCH 31/56] Reformat --- .../src/main/kotlin/DistributionConfig.kt | 3 +- .../v2/config/BiomePipelineTemplate.java | 2 +- .../pipeline/api/delegate/SelfDelegate.java | 4 +- .../config/BiomePipelineTemplate.java | 2 +- .../config/BiomeProviderTemplate.java | 2 +- .../generation/NoiseChunkGenerator3D.java | 6 +-- .../commands/addons/AddonsCommandAddon.java | 6 +-- .../structure/StructureCommandAddon.java | 14 ++--- .../dfsek/terra/addons/noise/NoiseAddon.java | 39 +++----------- .../templates/ImageSamplerTemplate.java | 9 ++-- .../noise/SaltedNoiseFunction2.java | 3 +- .../noise/SaltedNoiseFunction3.java | 3 +- .../feature/FeatureGenerationStage.java | 2 +- .../addons/terrascript/parser/ParserUtil.java | 8 +-- .../command/arguments/RegistryArgument.java | 25 +++++---- .../platform/CommandRegistrationEvent.java | 4 +- .../api/util/reflection/ReflectionUtil.java | 4 +- .../event/FunctionalEventHandlerImpl.java | 17 +++--- .../com/dfsek/terra/bukkit/BukkitEntity.java | 6 +-- .../dfsek/terra/bukkit/TerraBukkitPlugin.java | 10 ++-- .../bukkit/handles/BukkitWorldHandle.java | 5 +- .../dfsek/terra/bukkit/nms/Initializer.java | 5 +- .../dfsek/terra/bukkit/util/VersionUtil.java | 2 +- .../bukkit/nms/v1_21/AwfulBukkitHacks.java | 4 +- .../bukkit/nms/v1_21/NMSBiomeProvider.java | 8 +-- .../bukkit/nms/v1_21/NMSInjectListener.java | 4 +- .../java/com/dfsek/terra/mod/ModPlatform.java | 52 +++++++++---------- .../config/BiomeParticleConfigTemplate.java | 3 +- .../mod/config/SpawnSettingsTemplate.java | 2 +- .../terra/mod/config/SpawnTypeConfig.java | 6 +-- .../MinecraftChunkGeneratorWrapper.java | 2 - .../mod/generation/TerraBiomeSource.java | 1 - .../terra/mod/handle/MinecraftItemHandle.java | 5 +- .../mod/handle/MinecraftWorldHandle.java | 5 +- .../entity/MobSpawnerBlockEntityMixin.java | 5 +- .../terra/block/state/BlockStateMixin.java | 1 - .../terra/inventory/item/ItemStackMixin.java | 11 ++-- .../inventory/meta/EnchantmentMixin.java | 10 ++-- .../inventory/meta/ItemStackMetaMixin.java | 6 +-- .../terra/world/ChunkRegionMixin.java | 9 ++-- .../lifecycle/DataPackContentsMixin.java | 1 + .../com/dfsek/terra/mod/util/PresetUtil.java | 5 +- .../terra/lifecycle/LifecycleEntryPoint.java | 4 +- .../mixin/lifecycle/RegistryLoaderMixin.java | 49 ++++++----------- .../mixin/lifecycle/SaveLoadingMixin.java | 8 ++- 45 files changed, 163 insertions(+), 219 deletions(-) diff --git a/buildSrc/src/main/kotlin/DistributionConfig.kt b/buildSrc/src/main/kotlin/DistributionConfig.kt index 12ebd8376..0a1c2d060 100644 --- a/buildSrc/src/main/kotlin/DistributionConfig.kt +++ b/buildSrc/src/main/kotlin/DistributionConfig.kt @@ -27,7 +27,8 @@ fun Project.configureDistribution() { group = "terra" doFirst { file("${buildDir}/resources/main/packs/").deleteRecursively() - val defaultPackUrl = URL("https://github.com/PolyhedralDev/TerraOverworldConfig/releases/download/" + Versions.Terra.overworldConfig + "/default.zip") + val defaultPackUrl = + URL("https://github.com/PolyhedralDev/TerraOverworldConfig/releases/download/" + Versions.Terra.overworldConfig + "/default.zip") downloadPack(defaultPackUrl, project) } } diff --git a/common/addons/biome-provider-pipeline-v2/src/main/java/com/dfsek/terra/addons/biome/pipeline/v2/config/BiomePipelineTemplate.java b/common/addons/biome-provider-pipeline-v2/src/main/java/com/dfsek/terra/addons/biome/pipeline/v2/config/BiomePipelineTemplate.java index 937a1b7df..75ffb8d65 100644 --- a/common/addons/biome-provider-pipeline-v2/src/main/java/com/dfsek/terra/addons/biome/pipeline/v2/config/BiomePipelineTemplate.java +++ b/common/addons/biome-provider-pipeline-v2/src/main/java/com/dfsek/terra/addons/biome/pipeline/v2/config/BiomePipelineTemplate.java @@ -29,7 +29,7 @@ public class BiomePipelineTemplate implements ObjectTemplate { @Default @Description(""" The resolution at which to sample biomes. - + Larger values are quadratically faster, but produce lower quality results. For example, a value of 3 would sample every 3 blocks.""") protected @Meta int resolution = 1; diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/delegate/SelfDelegate.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/delegate/SelfDelegate.java index 6b62818d2..c6762334a 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/delegate/SelfDelegate.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/delegate/SelfDelegate.java @@ -1,10 +1,10 @@ package com.dfsek.terra.addons.biome.pipeline.api.delegate; +import com.dfsek.terra.api.world.biome.Biome; + import java.util.Collections; import java.util.Set; -import com.dfsek.terra.api.world.biome.Biome; - final class SelfDelegate implements BiomeDelegate { public static final SelfDelegate INSTANCE = new SelfDelegate(); diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomePipelineTemplate.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomePipelineTemplate.java index 491f019ba..1566de524 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomePipelineTemplate.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomePipelineTemplate.java @@ -28,7 +28,7 @@ public class BiomePipelineTemplate extends BiomeProviderTemplate { @Description(""" The initial size of biome chunks. This value must be at least 2. This is not the final size of biome chunks. Final chunks will be much larger. - + It is recommended to keep biome chunks' final size in the range of [50, 300] to prevent performance issues. To calculate the size of biome chunks, simply take initial-size and for each expand stage, multiply the running value by 2 diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomeProviderTemplate.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomeProviderTemplate.java index f42fd7c20..93f84e80a 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomeProviderTemplate.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomeProviderTemplate.java @@ -22,7 +22,7 @@ public abstract class BiomeProviderTemplate implements ObjectTemplate>> NOISE_SAMPLER_TOKEN = new TypeKey<>() { diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/ImageSamplerTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/ImageSamplerTemplate.java index c7359426c..5503533d4 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/ImageSamplerTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/ImageSamplerTemplate.java @@ -8,15 +8,16 @@ package com.dfsek.terra.addons.noise.config.templates; import com.dfsek.tectonic.api.config.template.annotations.Value; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.awt.image.BufferedImage; import com.dfsek.terra.addons.noise.samplers.ImageSampler; import com.dfsek.terra.api.config.meta.Meta; import com.dfsek.terra.api.noise.NoiseSampler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.awt.image.BufferedImage; + @SuppressWarnings({ "unused", "FieldMayBeFinal" }) public class ImageSamplerTemplate extends SamplerTemplate { diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java index 2e8f72929..41ddd1247 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction2.java @@ -3,11 +3,10 @@ import com.dfsek.paralithic.functions.dynamic.Context; import com.dfsek.paralithic.functions.dynamic.DynamicFunction; import com.dfsek.paralithic.node.Statefulness; +import org.jetbrains.annotations.NotNull; import com.dfsek.terra.api.noise.NoiseSampler; -import org.jetbrains.annotations.NotNull; - public class SaltedNoiseFunction2 implements DynamicFunction { private final NoiseSampler gen; diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction3.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction3.java index 5dc483d5c..d4549127c 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction3.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/paralithic/noise/SaltedNoiseFunction3.java @@ -3,11 +3,10 @@ import com.dfsek.paralithic.functions.dynamic.Context; import com.dfsek.paralithic.functions.dynamic.DynamicFunction; import com.dfsek.paralithic.node.Statefulness; +import org.jetbrains.annotations.NotNull; import com.dfsek.terra.api.noise.NoiseSampler; -import org.jetbrains.annotations.NotNull; - public class SaltedNoiseFunction3 implements DynamicFunction { private final NoiseSampler gen; diff --git a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java index 123107d15..11a1e3ca7 100644 --- a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java +++ b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java @@ -62,7 +62,7 @@ public void populate(ProtoWorld world) { world.getBiomeProvider() .getColumn( tx + (doBlending ? (int) (blendSampler.noise(seed, tx, tz) * blendAmplitude) : 0), - tz + (doBlending ? (int) (blendSampler.noise(seed+1, tx, tz) * blendAmplitude) : 0), + tz + (doBlending ? (int) (blendSampler.noise(seed + 1, tx, tz) * blendAmplitude) : 0), world) .forRanges(resolution, (min, max, biome) -> { for(int subChunkX = 0; subChunkX < resolution; subChunkX++) { diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/parser/ParserUtil.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/parser/ParserUtil.java index 4fc805a8f..b982b0979 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/parser/ParserUtil.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/parser/ParserUtil.java @@ -7,15 +7,15 @@ package com.dfsek.terra.addons.terrascript.parser; +import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException; +import com.dfsek.terra.addons.terrascript.parser.lang.Returnable; +import com.dfsek.terra.addons.terrascript.tokenizer.Token; + import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException; -import com.dfsek.terra.addons.terrascript.parser.lang.Returnable; -import com.dfsek.terra.addons.terrascript.tokenizer.Token; - public class ParserUtil { diff --git a/common/api/src/main/java/com/dfsek/terra/api/command/arguments/RegistryArgument.java b/common/api/src/main/java/com/dfsek/terra/api/command/arguments/RegistryArgument.java index 91d6b56b9..8e15c18ce 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/command/arguments/RegistryArgument.java +++ b/common/api/src/main/java/com/dfsek/terra/api/command/arguments/RegistryArgument.java @@ -2,6 +2,15 @@ import io.leangen.geantyref.TypeToken; import org.checkerframework.checker.nullness.qual.NonNull; +import org.incendo.cloud.component.CommandComponent; +import org.incendo.cloud.component.DefaultValue; +import org.incendo.cloud.context.CommandContext; +import org.incendo.cloud.context.CommandInput; +import org.incendo.cloud.parser.ArgumentParseResult; +import org.incendo.cloud.parser.ArgumentParser; +import org.incendo.cloud.parser.ParserDescriptor; +import org.incendo.cloud.suggestion.Suggestion; +import org.incendo.cloud.suggestion.SuggestionProvider; import java.util.Optional; import java.util.concurrent.CompletableFuture; @@ -13,16 +22,6 @@ import com.dfsek.terra.api.registry.key.RegistryKey; import com.dfsek.terra.api.util.reflection.TypeKey; -import org.incendo.cloud.component.CommandComponent; -import org.incendo.cloud.component.DefaultValue; -import org.incendo.cloud.context.CommandContext; -import org.incendo.cloud.context.CommandInput; -import org.incendo.cloud.parser.ArgumentParseResult; -import org.incendo.cloud.parser.ArgumentParser; -import org.incendo.cloud.parser.ParserDescriptor; -import org.incendo.cloud.suggestion.Suggestion; -import org.incendo.cloud.suggestion.SuggestionProvider; - public class RegistryArgument { @@ -49,17 +48,17 @@ public static Builder builder(String name, Function CommandComponent of(String name, Function, Registry> registryFunction, - TypeKey registryType) { + TypeKey registryType) { return RegistryArgument.builder(name, registryFunction, registryType).build(); } public static CommandComponent optional(String name, Function, Registry> registryFunction, - TypeKey registryType) { + TypeKey registryType) { return RegistryArgument.builder(name, registryFunction, registryType).optional().build(); } public static CommandComponent optional(String name, Function, Registry> registryFunction, - TypeKey registryType, DefaultValue defaultKey) { + TypeKey registryType, DefaultValue defaultKey) { return RegistryArgument.builder(name, registryFunction, registryType).optional(defaultKey).build(); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java b/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java index 3ad041c9b..80088ff6d 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java +++ b/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java @@ -1,10 +1,10 @@ package com.dfsek.terra.api.event.events.platform; +import org.incendo.cloud.CommandManager; + import com.dfsek.terra.api.command.CommandSender; import com.dfsek.terra.api.event.events.Event; -import org.incendo.cloud.CommandManager; - public class CommandRegistrationEvent implements Event { private final CommandManager commandManager; diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/reflection/ReflectionUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/reflection/ReflectionUtil.java index 6b0c8fd28..2583b9ab6 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/reflection/ReflectionUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/reflection/ReflectionUtil.java @@ -30,11 +30,11 @@ public final class ReflectionUtil { private static final Unsafe UNSAFE; static { - try{ + try { final Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe"); unsafeField.setAccessible(true); UNSAFE = (Unsafe) unsafeField.get(null); - } catch(NoSuchFieldException | IllegalAccessException e){ + } catch(NoSuchFieldException | IllegalAccessException e) { throw new RuntimeException(e); } } diff --git a/common/implementation/base/src/main/java/com/dfsek/terra/event/FunctionalEventHandlerImpl.java b/common/implementation/base/src/main/java/com/dfsek/terra/event/FunctionalEventHandlerImpl.java index 67f984646..a35bf9366 100644 --- a/common/implementation/base/src/main/java/com/dfsek/terra/event/FunctionalEventHandlerImpl.java +++ b/common/implementation/base/src/main/java/com/dfsek/terra/event/FunctionalEventHandlerImpl.java @@ -17,17 +17,6 @@ package com.dfsek.terra.event; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import com.dfsek.terra.api.addon.BaseAddon; import com.dfsek.terra.api.event.events.Event; import com.dfsek.terra.api.event.events.FailThroughEvent; @@ -36,6 +25,12 @@ import com.dfsek.terra.api.event.functional.FunctionalEventHandler; import com.dfsek.terra.api.util.reflection.TypeKey; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.Type; +import java.util.*; + public class FunctionalEventHandlerImpl implements FunctionalEventHandler { private static final Logger logger = LoggerFactory.getLogger(FunctionalEventHandlerImpl.class); diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/BukkitEntity.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/BukkitEntity.java index 6df268180..98f44e2ec 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/BukkitEntity.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/BukkitEntity.java @@ -17,14 +17,14 @@ package com.dfsek.terra.bukkit; -import io.papermc.lib.PaperLib; -import org.bukkit.Location; - import com.dfsek.terra.api.entity.Entity; import com.dfsek.terra.api.util.vector.Vector3; import com.dfsek.terra.api.world.ServerWorld; import com.dfsek.terra.bukkit.world.BukkitAdapter; +import io.papermc.lib.PaperLib; +import org.bukkit.Location; + public class BukkitEntity implements Entity { private final org.bukkit.entity.Entity entity; diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java index 8c392dba1..e3bc1d837 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/TerraBukkitPlugin.java @@ -79,7 +79,7 @@ public void onEnable() { } catch(Exception e) { // This should never happen. logger.error(""" TERRA HAS BEEN DISABLED - + Errors occurred while registering commands. Please report this to Terra. """.strip(), e); @@ -102,13 +102,13 @@ private LegacyPaperCommandManager getCommandSenderPaperCommandMan BukkitAdapter::adapt )); - if (commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { + if(commandManager.hasCapability(CloudBukkitCapabilities.NATIVE_BRIGADIER)) { commandManager.registerBrigadier(); final CloudBrigadierManager brigManager = commandManager.brigadierManager(); if(brigManager != null) { brigManager.setNativeNumberSuggestions(false); } - } else if (commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { + } else if(commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) { commandManager.registerAsynchronousCompletions(); } @@ -181,7 +181,7 @@ private boolean doVersionCheck() { logger.warn(""" You are using Mohist, so we will not give you any support for issues that may arise. Since you enabled the "IKnowMohistCausesLotsOfIssuesButIWillUseItAnyways" flag, we won't disable Terra. But be warned. - + > I felt a great disturbance in the JVM, as if millions of plugins suddenly cried out in stack traces and were suddenly silenced. > I fear something terrible has happened. > - Astrash @@ -194,7 +194,7 @@ private boolean doVersionCheck() { @Override public @Nullable ChunkGenerator getDefaultWorldGenerator(@NotNull String worldName, String id) { - if (id == null || id.trim().equals("")) { return null; } + if(id == null || id.trim().equals("")) { return null; } return new BukkitChunkGeneratorWrapper(generatorMap.computeIfAbsent(worldName, name -> { ConfigPack pack = platform.getConfigRegistry().getByID(id).orElseThrow( () -> new IllegalArgumentException("No such config pack \"" + id + "\"")); diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/handles/BukkitWorldHandle.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/handles/BukkitWorldHandle.java index c6113bbd7..97f932c81 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/handles/BukkitWorldHandle.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/handles/BukkitWorldHandle.java @@ -61,8 +61,9 @@ public BukkitWorldHandle() { @Override public @NotNull EntityType getEntity(@NotNull String id) { - if (!id.contains(":")) { //TODO: remove in 7.0 - String newid = "minecraft:" + id.toLowerCase();; + if(!id.contains(":")) { //TODO: remove in 7.0 + String newid = "minecraft:" + id.toLowerCase(); + ; logger.warn( "Translating " + id + " to " + newid + ". In 1.20.3 entity parsing was reworked" + ". You are advised to perform this rename in your config backs as this translation will be removed in the next major " + diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java index 3f7375bc4..fc28e4bc3 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/nms/Initializer.java @@ -1,11 +1,10 @@ package com.dfsek.terra.bukkit.nms; -import com.dfsek.terra.bukkit.util.VersionUtil; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.dfsek.terra.bukkit.PlatformImpl; +import com.dfsek.terra.bukkit.util.VersionUtil; public interface Initializer { @@ -16,7 +15,7 @@ static boolean init(PlatformImpl platform) { Logger logger = LoggerFactory.getLogger(Initializer.class); try { String packageVersion = NMS; - if (NMS.equals("v1_21_1")) { + if(NMS.equals("v1_21_1")) { packageVersion = "v1_21"; } diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java index 6a8c662e0..3f32b6be2 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/util/VersionUtil.java @@ -112,7 +112,7 @@ public String toString() { if(major == -1 && minor == -1 && patch == -1) return "Unknown"; - if (patch >= 0) { + if(patch >= 0) { return String.format("v%d.%d.%d", major, minor, patch); } else { return String.format("v%d.%d", major, minor); diff --git a/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java index fc5cc0367..42d683394 100644 --- a/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/AwfulBukkitHacks.java @@ -10,7 +10,6 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.biome.Biome; import org.bukkit.NamespacedKey; import org.slf4j.Logger; @@ -42,7 +41,8 @@ public static void registerBiomes(ConfigRegistry configRegistry) { try { BukkitPlatformBiome platformBiome = (BukkitPlatformBiome) biome.getPlatformBiome(); NamespacedKey vanillaBukkitKey = platformBiome.getHandle().getKey(); - ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(), vanillaBukkitKey.getKey()); + ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(), + vanillaBukkitKey.getKey()); Biome platform = NMSBiomeInjector.createBiome(biome, Objects.requireNonNull(biomeRegistry.get(vanillaMinecraftKey))); ResourceKey delegateKey = ResourceKey.create( diff --git a/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeProvider.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeProvider.java index 18184144f..8abe26a51 100644 --- a/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeProvider.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSBiomeProvider.java @@ -37,10 +37,10 @@ protected Stream> collectPossibleBiomes() { @Override protected @NotNull MapCodec codec() { return MapCodec.assumeMapUnsafe(BiomeSource.CODEC); -// return MapCodec.unit(null); -// BuiltInRegistries.BIOME_SOURCE.byNameCodec().dispatchMap(this::codec, Function.identity()); -// BuiltInRegistries.BIOME_SOURCE.byNameCodec().dispatchStable(BiomeSource::codec, Function.identity()); -// return BiomeSource.CODEC; + // return MapCodec.unit(null); + // BuiltInRegistries.BIOME_SOURCE.byNameCodec().dispatchMap(this::codec, Function.identity()); + // BuiltInRegistries.BIOME_SOURCE.byNameCodec().dispatchStable(BiomeSource::codec, Function.identity()); + // return BiomeSource.CODEC; } @Override diff --git a/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java index b471faa88..927b019ed 100644 --- a/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java +++ b/platforms/bukkit/nms/v1_21/src/main/java/com/dfsek/terra/bukkit/nms/v1_21/NMSInjectListener.java @@ -1,12 +1,9 @@ package com.dfsek.terra.bukkit.nms.v1_21; -import com.dfsek.terra.api.util.reflection.ReflectionUtil; - import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.status.WorldGenContext; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.event.EventHandler; @@ -20,6 +17,7 @@ import java.util.concurrent.locks.ReentrantLock; import com.dfsek.terra.api.config.ConfigPack; +import com.dfsek.terra.api.util.reflection.ReflectionUtil; import com.dfsek.terra.bukkit.generator.BukkitChunkGeneratorWrapper; diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java index 308f7913c..09681f6b6 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java @@ -68,32 +68,32 @@ public void registerWorldTypes(BiConsumer registerFunct public void register(TypeRegistry registry) { super.register(registry); registry.registerLoader(PlatformBiome.class, (type, o, loader, depthTracker) -> parseBiome((String) o, depthTracker)) - .registerLoader(Identifier.class, (type, o, loader, depthTracker) -> { - Identifier identifier = Identifier.tryParse((String) o); - if(identifier == null) - throw new LoadException("Invalid identifier: " + o, depthTracker); - return identifier; - }) - .registerLoader(Precipitation.class, (type, o, loader, depthTracker) -> Precipitation.valueOf(((String) o).toUpperCase( - Locale.ROOT))) - .registerLoader(GrassColorModifier.class, - (type, o, loader, depthTracker) -> GrassColorModifier.valueOf(((String) o).toUpperCase( - Locale.ROOT))) - .registerLoader(GrassColorModifier.class, - (type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase( - Locale.ROOT))) - .registerLoader(SpawnGroup.class,(type, o, loader, depthTracker) -> SpawnGroup.valueOf((String) o)) - .registerLoader(BiomeParticleConfig.class, BiomeParticleConfigTemplate::new) - .registerLoader(SoundEvent.class, SoundEventTemplate::new) - .registerLoader(BiomeMoodSound.class, BiomeMoodSoundTemplate::new) - .registerLoader(BiomeAdditionsSound.class, BiomeAdditionsSoundTemplate::new) - .registerLoader(MusicSound.class, MusicSoundTemplate::new) - .registerLoader(EntityType.class, EntityTypeTemplate::new) - .registerLoader(SpawnCostConfig.class, SpawnCostConfig::new) - .registerLoader(SpawnEntry.class, SpawnEntryTemplate::new) - .registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new) - .registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new) - .registerLoader(VillagerType.class, VillagerTypeTemplate::new); + .registerLoader(Identifier.class, (type, o, loader, depthTracker) -> { + Identifier identifier = Identifier.tryParse((String) o); + if(identifier == null) + throw new LoadException("Invalid identifier: " + o, depthTracker); + return identifier; + }) + .registerLoader(Precipitation.class, (type, o, loader, depthTracker) -> Precipitation.valueOf(((String) o).toUpperCase( + Locale.ROOT))) + .registerLoader(GrassColorModifier.class, + (type, o, loader, depthTracker) -> GrassColorModifier.valueOf(((String) o).toUpperCase( + Locale.ROOT))) + .registerLoader(GrassColorModifier.class, + (type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase( + Locale.ROOT))) + .registerLoader(SpawnGroup.class, (type, o, loader, depthTracker) -> SpawnGroup.valueOf((String) o)) + .registerLoader(BiomeParticleConfig.class, BiomeParticleConfigTemplate::new) + .registerLoader(SoundEvent.class, SoundEventTemplate::new) + .registerLoader(BiomeMoodSound.class, BiomeMoodSoundTemplate::new) + .registerLoader(BiomeAdditionsSound.class, BiomeAdditionsSoundTemplate::new) + .registerLoader(MusicSound.class, MusicSoundTemplate::new) + .registerLoader(EntityType.class, EntityTypeTemplate::new) + .registerLoader(SpawnCostConfig.class, SpawnCostConfig::new) + .registerLoader(SpawnEntry.class, SpawnEntryTemplate::new) + .registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new) + .registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new) + .registerLoader(VillagerType.class, VillagerTypeTemplate::new); } private ProtoPlatformBiome parseBiome(String id, DepthTracker tracker) throws LoadException { diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/BiomeParticleConfigTemplate.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/BiomeParticleConfigTemplate.java index 3bc4474b6..457566444 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/BiomeParticleConfigTemplate.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/BiomeParticleConfigTemplate.java @@ -28,7 +28,8 @@ public BiomeParticleConfig get() { try { return new BiomeParticleConfig( - ParticleEffectArgumentType.readParameters(new StringReader(particle), (RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE.getReadOnlyWrapper()), + ParticleEffectArgumentType.readParameters(new StringReader(particle), + (RegistryWrapper.WrapperLookup) Registries.PARTICLE_TYPE.getReadOnlyWrapper()), probability); } catch(CommandSyntaxException e) { throw new RuntimeException(e); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnSettingsTemplate.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnSettingsTemplate.java index 86e9de007..a0e8932e5 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnSettingsTemplate.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnSettingsTemplate.java @@ -28,7 +28,7 @@ public SpawnSettings get() { SpawnSettings.Builder builder = new SpawnSettings.Builder(); for(SpawnTypeConfig spawn : spawns) { SpawnGroup group = spawn.getGroup(); - for (SpawnEntry entry : spawn.getEntry()) { + for(SpawnEntry entry : spawn.getEntry()) { builder.spawn(group, entry); } } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnTypeConfig.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnTypeConfig.java index b18c87e62..0eba7ca67 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnTypeConfig.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/SpawnTypeConfig.java @@ -13,15 +13,15 @@ public class SpawnTypeConfig implements ObjectTemplate { @Value("group") @Default private SpawnGroup group = null; - + @Value("entries") @Default private List entry = null; - + public SpawnGroup getGroup() { return group; } - + public List getEntry() { return entry; } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java index c73ad3f3b..46f5601de 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java @@ -17,7 +17,6 @@ package com.dfsek.terra.mod.generation; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -49,7 +48,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; import com.dfsek.terra.api.config.ConfigPack; import com.dfsek.terra.api.world.biome.generation.BiomeProvider; diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/TerraBiomeSource.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/TerraBiomeSource.java index 533a8c98b..81651ece8 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/TerraBiomeSource.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/TerraBiomeSource.java @@ -17,7 +17,6 @@ package com.dfsek.terra.mod.generation; -import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.world.biome.Biome; diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java index e9a5f5ae4..c9ef02f37 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftItemHandle.java @@ -21,10 +21,8 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.minecraft.command.CommandRegistryAccess; import net.minecraft.command.argument.ItemStackArgumentType; -import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.RegistryWrapper.Impl; import net.minecraft.util.Identifier; @@ -67,6 +65,7 @@ public Enchantment getEnchantment(String id) { @Override public Set getEnchantments() { - return CommonPlatform.get().enchantmentRegistry().stream().map(enchantment -> (Enchantment) (Object) enchantment).collect(Collectors.toSet()); + return CommonPlatform.get().enchantmentRegistry().stream().map(enchantment -> (Enchantment) (Object) enchantment).collect( + Collectors.toSet()); } } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftWorldHandle.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftWorldHandle.java index 3b5e1fe49..c36744d18 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftWorldHandle.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/handle/MinecraftWorldHandle.java @@ -64,8 +64,9 @@ public class MinecraftWorldHandle implements WorldHandle { @Override public @NotNull EntityType getEntity(@NotNull String id) { - if (!id.contains(":")) { //TODO: remove in 7.0 - String newid = "minecraft:" + id.toLowerCase();; + if(!id.contains(":")) { //TODO: remove in 7.0 + String newid = "minecraft:" + id.toLowerCase(); + ; logger.warn( "Translating " + id + " to " + newid + ". In 1.20.3 entity parsing was reworked" + ". You are advised to perform this rename in your config packs as this translation will be removed in the next major " + diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java index caf918d1d..15e8fab34 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/entity/MobSpawnerBlockEntityMixin.java @@ -48,7 +48,8 @@ private MobSpawnerBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockS @Shadow public abstract MobSpawnerLogic getLogic(); -//method_46408 + + //method_46408 @Shadow public abstract void setEntityType(net.minecraft.entity.EntityType entityType, Random random); @@ -59,7 +60,7 @@ private MobSpawnerBlockEntityMixin(BlockEntityType type, BlockPos pos, BlockS public void terra$setSpawnedType(@NotNull EntityType creatureType) { Random rand; - if (hasWorld()) { + if(hasWorld()) { rand = world.getRandom(); } else { rand = Random.create(); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/state/BlockStateMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/state/BlockStateMixin.java index 9ecb3eccc..4243bf942 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/state/BlockStateMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/block/state/BlockStateMixin.java @@ -1,7 +1,6 @@ package com.dfsek.terra.mod.mixin.implementations.terra.block.state; -import com.google.common.collect.ImmutableMap; import com.mojang.serialization.MapCodec; import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap; import net.minecraft.block.AbstractBlock.AbstractBlockState; diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java index 70177be1f..76121f64b 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/item/ItemStackMixin.java @@ -17,13 +17,10 @@ package com.dfsek.terra.mod.mixin.implementations.terra.inventory.item; -import net.minecraft.component.Component; import net.minecraft.component.ComponentChanges; import net.minecraft.component.ComponentMap; import net.minecraft.component.ComponentMapImpl; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Implements; import org.spongepowered.asm.mixin.Interface; @@ -38,6 +35,10 @@ @Mixin(ItemStack.class) @Implements(@Interface(iface = com.dfsek.terra.api.inventory.ItemStack.class, prefix = "terra$")) public abstract class ItemStackMixin { + @Shadow + @Final + private ComponentMapImpl components; + @Shadow public abstract int getCount(); @@ -53,10 +54,6 @@ public abstract class ItemStackMixin { @Shadow public abstract ComponentMap getComponents(); - @Shadow - @Final - private ComponentMapImpl components; - public int terra$getAmount() { return getCount(); } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/EnchantmentMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/EnchantmentMixin.java index dd7cfbce0..8f58fb9d8 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/EnchantmentMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/EnchantmentMixin.java @@ -17,10 +17,7 @@ package com.dfsek.terra.mod.mixin.implementations.terra.inventory.meta; -import com.dfsek.terra.mod.CommonPlatform; - import net.minecraft.enchantment.Enchantment; -import net.minecraft.registry.Registries; import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.entry.RegistryEntryList; import org.spongepowered.asm.mixin.Final; @@ -32,6 +29,7 @@ import java.util.Objects; import com.dfsek.terra.api.inventory.ItemStack; +import com.dfsek.terra.mod.CommonPlatform; import static net.minecraft.enchantment.Enchantment.canBeCombined; @@ -39,13 +37,13 @@ @Mixin(Enchantment.class) @Implements(@Interface(iface = com.dfsek.terra.api.inventory.item.Enchantment.class, prefix = "terra$")) public abstract class EnchantmentMixin { - @Shadow - public abstract boolean isAcceptableItem(net.minecraft.item.ItemStack stack); - @Shadow @Final private RegistryEntryList exclusiveSet; + @Shadow + public abstract boolean isAcceptableItem(net.minecraft.item.ItemStack stack); + @SuppressWarnings("ConstantConditions") public boolean terra$canEnchantItem(ItemStack itemStack) { return isAcceptableItem((net.minecraft.item.ItemStack) (Object) itemStack); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java index a3bcf54df..91a487d0b 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/inventory/meta/ItemStackMetaMixin.java @@ -19,9 +19,6 @@ import net.minecraft.component.type.ItemEnchantmentsComponent; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtList; -import net.minecraft.registry.Registries; import net.minecraft.registry.entry.RegistryEntry; import org.spongepowered.asm.mixin.Implements; import org.spongepowered.asm.mixin.Interface; @@ -49,7 +46,8 @@ public abstract class ItemStackMetaMixin { @Shadow public abstract void addEnchantment(RegistryEntry enchantment, int level); - public void terra$addEnchantment(Enchantment enchantment, int level) { ; + public void terra$addEnchantment(Enchantment enchantment, int level) { + ; addEnchantment(RegistryEntry.of((net.minecraft.enchantment.Enchantment) (Object) enchantment), level); } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java index 7ae5441d0..70a62ae79 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/implementations/terra/world/ChunkRegionMixin.java @@ -17,8 +17,6 @@ package com.dfsek.terra.mod.mixin.implementations.terra.world; -import com.dfsek.terra.mod.mixin.invoke.FluidBlockInvoker; - import net.minecraft.block.FluidBlock; import net.minecraft.fluid.Fluid; import net.minecraft.util.collection.BoundedRegionArray; @@ -27,7 +25,6 @@ import net.minecraft.world.WorldAccess; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkGenerationStep; -import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.tick.MultiTickScheduler; import net.minecraft.world.tick.OrderedTick; import org.spongepowered.asm.mixin.Final; @@ -40,8 +37,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.List; - import com.dfsek.terra.api.block.entity.BlockEntity; import com.dfsek.terra.api.block.state.BlockState; import com.dfsek.terra.api.config.ConfigPack; @@ -52,6 +47,7 @@ import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator; import com.dfsek.terra.api.world.chunk.generation.ProtoWorld; import com.dfsek.terra.mod.generation.MinecraftChunkGeneratorWrapper; +import com.dfsek.terra.mod.mixin.invoke.FluidBlockInvoker; import com.dfsek.terra.mod.util.MinecraftUtil; @@ -78,7 +74,8 @@ public abstract class ChunkRegionMixin { @Inject(at = @At("RETURN"), - method = "(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/collection/BoundedRegionArray;Lnet/minecraft/world/chunk/ChunkGenerationStep;Lnet/minecraft/world/chunk/Chunk;)V") + method = "(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/collection/BoundedRegionArray;" + + "Lnet/minecraft/world/chunk/ChunkGenerationStep;Lnet/minecraft/world/chunk/Chunk;)V") public void injectConstructor(net.minecraft.server.world.ServerWorld world, BoundedRegionArray chunks, ChunkGenerationStep generationStep, Chunk centerPos, CallbackInfo ci) { this.terra$config = ((ServerWorld) world).getPack(); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java index 305f7f024..680c1833c 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java @@ -22,6 +22,7 @@ public class DataPackContentsMixin { @Shadow @Final private ReloadableRegistries.Lookup reloadableRegistries; + /* * #refresh populates all tags in the registries */ diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java index de147c509..32c19a405 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java @@ -45,8 +45,9 @@ public static Pair createDefault(ConfigPack pack, ModPl .orElseThrow(); - Identifier generatorID = Identifier.tryParse("terra:" + pack.getID().toLowerCase(Locale.ROOT) + "/" + pack.getNamespace().toLowerCase( - Locale.ROOT)); + Identifier generatorID = Identifier.tryParse( + "terra:" + pack.getID().toLowerCase(Locale.ROOT) + "/" + pack.getNamespace().toLowerCase( + Locale.ROOT)); PRESETS.add(generatorID); diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java index 65d86febf..0cbfa77b4 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java @@ -20,8 +20,8 @@ public static void initialize(String modName, LifecyclePlatform platform) { FabricServerCommandManager manager = new FabricServerCommandManager<>( ExecutionCoordinator.simpleCoordinator(), SenderMapper.create( - serverCommandSource -> (CommandSender) serverCommandSource, - commandSender -> (ServerCommandSource) commandSender) + serverCommandSource -> (CommandSender) serverCommandSource, + commandSender -> (ServerCommandSource) commandSender) ); diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java index a5d2a9bde..b1ff48396 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java @@ -1,15 +1,13 @@ package com.dfsek.terra.lifecycle.mixin.lifecycle; -import com.mojang.datafixers.util.Pair; import net.minecraft.enchantment.Enchantment; -import net.minecraft.registry.DynamicRegistryManager; -import net.minecraft.registry.DynamicRegistryManager.Immutable; import net.minecraft.registry.MutableRegistry; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.RegistryLoader; import net.minecraft.registry.RegistryLoader.Loader; +import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.MultiNoiseBiomeSourceParameterList; import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.gen.WorldPreset; @@ -20,7 +18,6 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import java.util.List; @@ -31,8 +28,6 @@ import com.dfsek.terra.lifecycle.util.LifecycleUtil; import com.dfsek.terra.lifecycle.util.RegistryHack; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - @Mixin(RegistryLoader.class) public class RegistryLoaderMixin { @@ -40,21 +35,10 @@ public class RegistryLoaderMixin { @Shadow @Final private static Logger LOGGER; -// @Inject( -// method = "load(Lnet/minecraft/registry/RegistryLoader$RegistryLoadable;Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;", -// at = @At( -// value = "INVOKE", -// target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", -// ordinal = 1 // we want right after the first forEach -// ) -// ) -// private static void grabRegiestry(RegistryLoader.RegistryLoadable loadable, DynamicRegistryManager baseRegistryManager, -// List> entries, CallbackInfoReturnable cir) { -// entries.forEach((loader) -> { -// Registry registry = loader.registry(); -// } + @Redirect( - method = "load(Lnet/minecraft/registry/RegistryLoader$RegistryLoadable;Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;", + method = "load(Lnet/minecraft/registry/RegistryLoader$RegistryLoadable;Lnet/minecraft/registry/DynamicRegistryManager;" + + "Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;", at = @At( value = "INVOKE", target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", @@ -62,20 +46,19 @@ public class RegistryLoaderMixin { ) ) private static void grabManager(List> instance, Consumer> consumer) { - if (!initialized) { - extractRegistry(instance, RegistryKeys.BIOME).ifPresent( - biomes -> { // this redirect triggers twice, second time only with dimension registry. don't try extraction second time - MutableRegistry dimensionTypes = extractRegistry(instance, RegistryKeys.DIMENSION_TYPE).orElseThrow(); - MutableRegistry worldPresets = extractRegistry(instance, RegistryKeys.WORLD_PRESET).orElseThrow(); - MutableRegistry chunkGeneratorSettings = extractRegistry(instance, - RegistryKeys.CHUNK_GENERATOR_SETTINGS).orElseThrow(); - MutableRegistry multiNoiseBiomeSourceParameterLists = extractRegistry(instance, - RegistryKeys.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST).orElseThrow(); - MutableRegistry enchantments = extractRegistry(instance, RegistryKeys.ENCHANTMENT).orElseThrow(); + if(!initialized) { + MutableRegistry biomes = extractRegistry(instance, RegistryKeys.BIOME).orElseThrow(); + MutableRegistry dimensionTypes = extractRegistry(instance, RegistryKeys.DIMENSION_TYPE).orElseThrow(); + MutableRegistry worldPresets = extractRegistry(instance, RegistryKeys.WORLD_PRESET).orElseThrow(); + MutableRegistry chunkGeneratorSettings = extractRegistry(instance, + RegistryKeys.CHUNK_GENERATOR_SETTINGS).orElseThrow(); + MutableRegistry multiNoiseBiomeSourceParameterLists = extractRegistry(instance, + RegistryKeys.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST).orElseThrow(); + MutableRegistry enchantments = extractRegistry(instance, RegistryKeys.ENCHANTMENT).orElseThrow(); - LifecyclePlatform.setRegistries(biomes, dimensionTypes, chunkGeneratorSettings, multiNoiseBiomeSourceParameterLists, enchantments); - LifecycleUtil.initialize(biomes, worldPresets); - }); + LifecyclePlatform.setRegistries(biomes, dimensionTypes, chunkGeneratorSettings, multiNoiseBiomeSourceParameterLists, + enchantments); + LifecycleUtil.initialize(biomes, worldPresets); initialized = true; } instance.forEach(consumer); diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/SaveLoadingMixin.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/SaveLoadingMixin.java index 0bf675fc2..89490ef41 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/SaveLoadingMixin.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/SaveLoadingMixin.java @@ -13,10 +13,14 @@ @Mixin(SaveLoading.class) public class SaveLoadingMixin { @ModifyArg( - method = "load(Lnet/minecraft/server/SaveLoading$ServerConfig;Lnet/minecraft/server/SaveLoading$LoadContextSupplier;Lnet/minecraft/server/SaveLoading$SaveApplierFactory;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;", + method = "load(Lnet/minecraft/server/SaveLoading$ServerConfig;Lnet/minecraft/server/SaveLoading$LoadContextSupplier;" + + "Lnet/minecraft/server/SaveLoading$SaveApplierFactory;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)" + + "Ljava/util/concurrent/CompletableFuture;", at = @At( value = "INVOKE", - target = "Lnet/minecraft/registry/RegistryLoader;loadFromResource(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;" ), + target = "Lnet/minecraft/registry/RegistryLoader;loadFromResource(Lnet/minecraft/resource/ResourceManager;" + + "Lnet/minecraft/registry/DynamicRegistryManager;Ljava/util/List;)" + + "Lnet/minecraft/registry/DynamicRegistryManager$Immutable;"), index = 1 ) private static DynamicRegistryManager grabManager(DynamicRegistryManager registryManager) { From 06457bf3ced441619bc9ac0994b7842dc33ea323 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Wed, 18 Sep 2024 15:43:31 -0600 Subject: [PATCH 32/56] some fixes --- .../com/dfsek/terra/mod/mixin/invoke/FluidBlockInvoker.java | 2 +- .../src/main/resources/terra.common.mixins.json | 1 + .../lifecycle/mixin/lifecycle/MinecraftServerMixin.java | 6 ++++++ .../lifecycle/mixin/lifecycle/RegistryLoaderMixin.java | 4 +++- .../java/com/dfsek/terra/lifecycle/util/LifecycleUtil.java | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/invoke/FluidBlockInvoker.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/invoke/FluidBlockInvoker.java index a6b50409c..620d03ec1 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/invoke/FluidBlockInvoker.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/invoke/FluidBlockInvoker.java @@ -10,5 +10,5 @@ @Mixin(FluidBlock.class) public interface FluidBlockInvoker { @Invoker("getFluidState") - public FluidState invokeGetFluidState(BlockState state); + FluidState invokeGetFluidState(BlockState state); } diff --git a/platforms/mixin-common/src/main/resources/terra.common.mixins.json b/platforms/mixin-common/src/main/resources/terra.common.mixins.json index f8d0718e4..e25cb7da4 100644 --- a/platforms/mixin-common/src/main/resources/terra.common.mixins.json +++ b/platforms/mixin-common/src/main/resources/terra.common.mixins.json @@ -36,6 +36,7 @@ "implementations.terra.inventory.meta.ItemStackMetaMixin", "implementations.terra.world.ChunkRegionMixin", "implementations.terra.world.ServerWorldMixin", + "invoke.FluidBlockInvoker", "lifecycle.DataPackContentsMixin" ], "client": [ diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/MinecraftServerMixin.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/MinecraftServerMixin.java index 25ac340d0..63a8b8170 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/MinecraftServerMixin.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/MinecraftServerMixin.java @@ -16,6 +16,7 @@ import com.dfsek.terra.lifecycle.LifecyclePlatform; +import static com.dfsek.terra.lifecycle.util.LifecycleUtil.initialized; @Mixin(MinecraftServer.class) public class MinecraftServerMixin { @@ -29,4 +30,9 @@ private void injectConstructor(Thread serverThread, LevelStorage.Session session WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory, CallbackInfo ci) { LifecyclePlatform.setServer((MinecraftServer) (Object) this); } + + @Inject(method = "shutdown()V", at = @At("RETURN")) + private void injectShutdown(CallbackInfo ci) { + initialized = false; + } } diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java index b1ff48396..739c084f3 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/RegistryLoaderMixin.java @@ -28,10 +28,12 @@ import com.dfsek.terra.lifecycle.util.LifecycleUtil; import com.dfsek.terra.lifecycle.util.RegistryHack; +import static com.dfsek.terra.lifecycle.util.LifecycleUtil.initialized; + @Mixin(RegistryLoader.class) public class RegistryLoaderMixin { - private static boolean initialized = false; + @Shadow @Final private static Logger LOGGER; diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/LifecycleUtil.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/LifecycleUtil.java index a251bedbd..28346a6eb 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/LifecycleUtil.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/LifecycleUtil.java @@ -12,6 +12,7 @@ public final class LifecycleUtil { + public static boolean initialized = false; private LifecycleUtil() { } From 3644ee7fca671dc2ca095f7c0eb6b898eb1345f7 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 16:28:34 -0600 Subject: [PATCH 33/56] Implement DerivateNoiseFunction --- .../noise/DerivativeFractalTemplate.java | 11 ++-- .../noise/DerivativeNoiseTemplate.java | 8 +++ .../noise/DerivativeNoiseFunction.java | 24 ++++++++ .../noise/simplex/DerivativeFractal.java | 57 ++++++++++++------- 4 files changed, 72 insertions(+), 28 deletions(-) create mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeNoiseTemplate.java create mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/DerivativeNoiseFunction.java diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java index 9387651a2..68e8c803d 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java @@ -7,7 +7,7 @@ import com.dfsek.terra.addons.noise.samplers.noise.simplex.DerivativeFractal; -public class DerivativeFractalTemplate extends SamplerTemplate { +public class DerivativeFractalTemplate extends DerivativeNoiseTemplate { @Value("octaves") @Default @@ -21,12 +21,11 @@ public class DerivativeFractalTemplate extends SamplerTemplate extends NoiseTemplate { + +} diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/DerivativeNoiseFunction.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/DerivativeNoiseFunction.java new file mode 100644 index 000000000..c5caa0d3a --- /dev/null +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/DerivativeNoiseFunction.java @@ -0,0 +1,24 @@ +package com.dfsek.terra.addons.noise.samplers.noise; + +import com.dfsek.terra.api.noise.DerivativeNoiseSampler; + +public abstract class DerivativeNoiseFunction extends NoiseFunction implements DerivativeNoiseSampler { + @Override + public boolean isDifferentiable() { + return true; + } + + @Override + public double[] noised(long seed, double x, double y) { + return getNoiseDerivativeRaw(seed + salt, x * frequency, y * frequency); + } + + @Override + public double[] noised(long seed, double x, double y, double z) { + return getNoiseDerivativeRaw(seed + salt, x * frequency, y * frequency, z * frequency); + } + + public abstract double[] getNoiseDerivativeRaw(long seed, double x, double y); + + public abstract double[] getNoiseDerivativeRaw(long seed, double x, double y, double z); +} diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java index 91fa69e0e..4d7edc2fe 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java @@ -1,29 +1,49 @@ package com.dfsek.terra.addons.noise.samplers.noise.simplex; -import com.dfsek.terra.api.noise.DerivativeNoiseSampler; +import com.dfsek.terra.addons.noise.samplers.noise.DerivativeNoiseFunction; import static com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion.dot; -import static com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion.hash; -import static com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion.hashX; -import static com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion.hashY; /** * Temporary sampler that provides derivatives to test pseudoerosion, should be replaced with * derivative versions of existing samplers */ -public class DerivativeFractal implements DerivativeNoiseSampler { +public class DerivativeFractal extends DerivativeNoiseFunction { private final int heightOctaves; private final double heightGain; private final double heightLacunarity; - private final double frequency; + private static final float HASH_X = 0.3183099f; + private static final float HASH_Y = 0.3678794f; - public DerivativeFractal(int octaves, double gain, double lacunarity, double frequency) { + public DerivativeFractal(int octaves, double gain, double lacunarity) { this.heightOctaves = octaves; this.heightGain = gain; this.heightLacunarity = lacunarity; - this.frequency = frequency; + } + + public static float hash(float x, float y) { + float xx = x * HASH_X + HASH_Y; + float yy = y * HASH_Y + HASH_X; + + // Swapped the components here + return 16 * (xx * yy * (xx + yy)); + } + + public static float hashX(float n) { + // Swapped the components here + float nx = HASH_X * n; + return -1.0f + 2.0f * fract(nx); + } + + public static float hashY(float n) { + float ny = HASH_Y * n; + return -1.0f + 2.0f * fract(ny); + } + + public static float fract(float x) { + return (x - (float)Math.floor(x)); } private static float[] baseNoise(float px, float py) { @@ -65,14 +85,7 @@ private static float[] baseNoise(float px, float py) { } @Override - public boolean isDifferentiable() { - return true; - } - - @Override - public double[] noised(long seed, double x, double y) { - x *= frequency; - y *= frequency; + public double[] getNoiseDerivativeRaw(long seed, double x, double y) { double[] out = { 0.0f, 0.0f, 0.0f }; float heightFreq = 1.0f; float heightAmp = 1f; @@ -93,17 +106,17 @@ public double[] noised(long seed, double x, double y) { } @Override - public double[] noised(long seed, double x, double y, double z) { - return noised(seed, x, z); + public double[] getNoiseDerivativeRaw(long seed, double x, double y, double z) { + return getNoiseDerivativeRaw(seed, x, y); } @Override - public double noise(long seed, double x, double y) { - return noised(seed, x, y)[0]; + public double getNoiseRaw(long seed, double x, double y) { + return getNoiseDerivativeRaw(seed, x, y)[0]; } @Override - public double noise(long seed, double x, double y, double z) { - return noised(seed, x, y, z)[0]; + public double getNoiseRaw(long seed, double x, double y, double z) { + return getNoiseRaw(seed, x, y); } } From b1ad820e1ca188218c08fd8d9433b9f1fe437759 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 16:37:42 -0600 Subject: [PATCH 34/56] Move pseudoerosion to NoiseFunction --- .../templates/noise/PseudoErosionTemplate.java | 13 ++++++++++--- .../samplers/noise/simplex/PseudoErosion.java | 14 +++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java index f5e1ac46c..d7f6b7562 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java @@ -3,12 +3,12 @@ import com.dfsek.tectonic.api.config.template.annotations.Default; import com.dfsek.tectonic.api.config.template.annotations.Value; -import com.dfsek.terra.addons.noise.config.templates.SamplerTemplate; import com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion; +import com.dfsek.terra.api.config.meta.Meta; import com.dfsek.terra.api.noise.DerivativeNoiseSampler; -public class PseudoErosionTemplate extends SamplerTemplate { +public class PseudoErosionTemplate extends NoiseTemplate { @Value("octaves") @Default @@ -61,10 +61,17 @@ public class PseudoErosionTemplate extends SamplerTemplate { @Default private boolean averageErosionImpulses = true; + @Value("frequency") + @Default + protected @Meta double frequency = 1d; + @Override public PseudoErosion get() { - return new PseudoErosion(octaves, gain, lacunarity, + PseudoErosion pseudoErosion = new PseudoErosion(octaves, gain, lacunarity, slopeStrength, branchStrength, strength, erosionFrequency, heightSampler, slopeMask, slopeMaskFull, slopeMaskNone, jitterModifier, averageErosionImpulses); + pseudoErosion.setFrequency(frequency); + pseudoErosion.setSalt(salt); + return pseudoErosion; } } diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java index 41b1e2db8..29a6d8e8b 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java @@ -1,12 +1,13 @@ package com.dfsek.terra.addons.noise.samplers.noise.simplex; +import com.dfsek.terra.addons.noise.samplers.noise.NoiseFunction; import com.dfsek.terra.api.noise.DerivativeNoiseSampler; import com.dfsek.terra.api.noise.NoiseSampler; import com.dfsek.terra.api.util.MathUtil; -public class PseudoErosion implements NoiseSampler { +public class PseudoErosion extends NoiseFunction { public static final float TAU = (float) (2.0 * Math.PI); private static final float HASH_X = 0.3183099f; private static final float HASH_Y = 0.3678794f; @@ -106,11 +107,6 @@ public float[] erosion(float x, float y, float dirX, float dirY) { return new float[] {noise, dirOutX, dirOutY}; } - public static double exp(double val) { - final long tmp = (long) (1512775 * val + 1072632447); - return Double.longBitsToDouble(tmp << 32); - } - public static float smoothstep(float edge0, float edge1, float x) { // Scale, bias and saturate x to 0..1 range x = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f); @@ -176,12 +172,12 @@ public static float dot(float x1, float y1, float x2, float y2) { } @Override - public double noise(long seed, double x, double y) { + public double getNoiseRaw(long seed, double x, double y) { return heightMap(seed, (float) x, (float) y); } @Override - public double noise(long seed, double x, double y, double z) { - return noise(seed, x, z); + public double getNoiseRaw(long seed, double x, double y, double z) { + return getNoiseRaw(seed, x, z); } } \ No newline at end of file From 07e3d0058d3c39e92bc0a4a19dbbba30f823e499 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 16:46:48 -0600 Subject: [PATCH 35/56] Refractor PseudoErosion --- .../templates/noise/PseudoErosionTemplate.java | 8 ++++---- .../PseudoErosion.java => PseudoErosionSampler.java} | 12 +++++------- .../samplers/noise/simplex/DerivativeFractal.java | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) rename common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/{simplex/PseudoErosion.java => PseudoErosionSampler.java} (92%) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java index d7f6b7562..f815cd40c 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java @@ -3,12 +3,12 @@ import com.dfsek.tectonic.api.config.template.annotations.Default; import com.dfsek.tectonic.api.config.template.annotations.Value; -import com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion; +import com.dfsek.terra.addons.noise.samplers.noise.PseudoErosionSampler; import com.dfsek.terra.api.config.meta.Meta; import com.dfsek.terra.api.noise.DerivativeNoiseSampler; -public class PseudoErosionTemplate extends NoiseTemplate { +public class PseudoErosionTemplate extends NoiseTemplate { @Value("octaves") @Default @@ -66,8 +66,8 @@ public class PseudoErosionTemplate extends NoiseTemplate { protected @Meta double frequency = 1d; @Override - public PseudoErosion get() { - PseudoErosion pseudoErosion = new PseudoErosion(octaves, gain, lacunarity, + public PseudoErosionSampler get() { + PseudoErosionSampler pseudoErosion = new PseudoErosionSampler(octaves, gain, lacunarity, slopeStrength, branchStrength, strength, erosionFrequency, heightSampler, slopeMask, slopeMaskFull, slopeMaskNone, jitterModifier, averageErosionImpulses); pseudoErosion.setFrequency(frequency); diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java similarity index 92% rename from common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java rename to common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java index 29a6d8e8b..7aeff49ac 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/PseudoErosion.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java @@ -1,13 +1,11 @@ -package com.dfsek.terra.addons.noise.samplers.noise.simplex; +package com.dfsek.terra.addons.noise.samplers.noise; -import com.dfsek.terra.addons.noise.samplers.noise.NoiseFunction; import com.dfsek.terra.api.noise.DerivativeNoiseSampler; -import com.dfsek.terra.api.noise.NoiseSampler; import com.dfsek.terra.api.util.MathUtil; -public class PseudoErosion extends NoiseFunction { +public class PseudoErosionSampler extends NoiseFunction { public static final float TAU = (float) (2.0 * Math.PI); private static final float HASH_X = 0.3183099f; private static final float HASH_Y = 0.3678794f; @@ -27,9 +25,9 @@ public class PseudoErosion extends NoiseFunction { private final double maxCellDistSqRecip; private final boolean averageErosionImpulses; - public PseudoErosion(int octaves, double gain, double lacunarity, double slopeStrength, double branchStrength, double erosionStrength, double erosionFrequency, DerivativeNoiseSampler sampler, - boolean slopeMask, double slopeMaskFull, double slopeMaskNone, double jitterModifier, - boolean averageErosionImpulses) { + public PseudoErosionSampler(int octaves, double gain, double lacunarity, double slopeStrength, double branchStrength, double erosionStrength, double erosionFrequency, DerivativeNoiseSampler sampler, + boolean slopeMask, double slopeMaskFull, double slopeMaskNone, double jitterModifier, + boolean averageErosionImpulses) { this.octaves = octaves; this.gain = gain; this.lacunarity = lacunarity; diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java index 4d7edc2fe..9a9e7f922 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java @@ -2,7 +2,7 @@ import com.dfsek.terra.addons.noise.samplers.noise.DerivativeNoiseFunction; -import static com.dfsek.terra.addons.noise.samplers.noise.simplex.PseudoErosion.dot; +import static com.dfsek.terra.addons.noise.samplers.noise.PseudoErosionSampler.dot; /** From 699d5d1d62dd2b4ac22afc61e31cf6912b9e2c38 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 19:42:50 -0600 Subject: [PATCH 36/56] Derivable OpenSimplex2S Impl baased on https://gist.github.com/KdotJPG/882f36b2ae5ae56a8fc91627ec1c87f4 --- .../noise/simplex/OpenSimplex2SSampler.java | 418 ++++++++++++++++++ .../noise/simplex/SimplexStyleSampler.java | 44 +- 2 files changed, 454 insertions(+), 8 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java index e3488a676..d9aec851e 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java @@ -276,4 +276,422 @@ public double getNoiseRaw(long sl, double x, double y, double z) { return value * 9.046026385208288; } + @Override + public boolean isDifferentiable() { + return true; + } + + @Override + public double[] getNoiseDerivativeRaw(long sl, double x, double y) { + int seed = (int) sl; + // 2D OpenSimplex2S case is a modified 2D simplex noise. + + final double SQRT3 = 1.7320508075688772935274463415059; + final double G2 = (3 - SQRT3) / 6; + + final double F2 = 0.5f * (SQRT3 - 1); + double s = (x + y) * F2; + x += s; + y += s; + + + int i = (int) Math.floor(x); + int j = (int) Math.floor(y); + double xi = x - i; + double yi = y - j; + + i *= PRIME_X; + j *= PRIME_Y; + int i1 = i + PRIME_X; + int j1 = j + PRIME_Y; + + double t = (xi + yi) * G2; + double x0 = xi - t; + double y0 = yi - t; + + double[] out = { 0.0f, 0.0f, 0.0f }; + + double a0 = (2.0 / 3.0) - x0 * x0 - y0 * y0; + double aa0 = a0 * a0, aaa0 = aa0 * a0, aaaa0 = aa0 * aa0; + int gi0 = gradCoordIndex(seed, i, j); + double gx0 = GRADIENTS_2_D[gi0], gy0 = GRADIENTS_2_D[gi0 | 1]; + double rampValue0 = gx0 * x0 + gy0 * y0; + out[0] = aaaa0 * rampValue0; + out[1] = gx0 * aaaa0 - 8 * rampValue0 * aaa0 * x0; + out[2] = gy0 * aaaa0 - 8 * rampValue0 * aaa0 * y0; + + + + double a1 = 2 * (1 - 2 * G2) * (1 / G2 - 2) * t + ((-2 * (1 - 2 * G2) * (1 - 2 * G2)) + a0); + double x1 = x0 - (1 - 2 * G2); + double y1 = y0 - (1 - 2 * G2); + double aa1 = a1 * a1, aaa1 = aa1 * a1, aaaa1 = aa1 * aa1; + int gi1 = gradCoordIndex(seed, i1, j1); + double gx1 = GRADIENTS_2_D[gi1], gy1 = GRADIENTS_2_D[gi1 | 1]; + double rampValue1 = gx1 * x1 + gy1 * y1; + out[0] += aaaa1 * rampValue1; + out[1] += gx1 * aaaa1 - 8 * rampValue1 * aaa1 * x1; + out[2] += gy1 * aaaa1 - 8 * rampValue1 * aaa1 * y1; + + // Nested conditionals were faster than compact bit logic/arithmetic. + double xmyi = xi - yi; + if(t > G2) { + if(xi + xmyi > 1) { + double x2 = x0 + (3 * G2 - 2); + double y2 = y0 + (3 * G2 - 1); + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i + (PRIME_X << 1), j + PRIME_Y); + double gx2 = GRADIENTS_2_D[gi2 | 0], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; + } + } else { + double x2 = x0 + G2; + double y2 = y0 + (G2 - 1); + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i, j + PRIME_Y); + double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; + } + } + + if(yi - xmyi > 1) { + double x3 = x0 + (3 * G2 - 1); + double y3 = y0 + (3 * G2 - 2); + double a3 = (2.0 / 3.0) - x3 * x3 - y3 * y3; + if(a3 > 0) { + double aa3 = a3 * a3, aaa3 = aa3 * a3, aaaa3 = aa3 * aa3; + int gi3 = gradCoordIndex(seed, i + PRIME_X, j + (PRIME_Y << 1)); + double gx3 = GRADIENTS_2_D[gi3], gy3 = GRADIENTS_2_D[gi3 | 1]; + double rampValue3 = gx3 * x3 + gy3 * y3; + out[0] += aaaa3 * rampValue3; + out[1] += gx3 * aaaa3 - 8 * rampValue3 * aaa3 * x3; + out[2] += gy3 * aaaa3 - 8 * rampValue3 * aaa3 * y3; + } + } else { + double x3 = x0 + (G2 - 1); + double y3 = y0 + G2; + double a3 = (2.0 / 3.0) - x3 * x3 - y3 * y3; + if(a3 > 0) { + double aa3 = a3 * a3, aaa3 = aa3 * a3, aaaa3 = aa3 * aa3; + int gi3 = gradCoordIndex(seed, i + PRIME_X, j); + double gx3 = GRADIENTS_2_D[gi3], gy3 = GRADIENTS_2_D[gi3 | 1]; + double rampValue3 = gx3 * x3 + gy3 * y3; + out[0] += aaaa3 * rampValue3; + out[1] += gx3 * aaaa3 - 8 * rampValue3 * aaa3 * x3; + out[2] += gy3 * aaaa3 - 8 * rampValue3 * aaa3 * y3; + } + } + } else { + if(xi + xmyi < 0) { + double x2 = x0 + (1 - G2); + double y2 = y0 - G2; + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i - PRIME_X, j); + double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; } + } else { + double x2 = x0 + (G2 - 1); + double y2 = y0 + G2; + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i + PRIME_X, j); + double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; + } + } + + if(yi < xmyi) { + double x2 = x0 - G2; + double y2 = y0 - (G2 - 1); + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i, j - PRIME_Y); + double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; } + } else { + double x2 = x0 + G2; + double y2 = y0 + (G2 - 1); + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i, j + PRIME_Y); + double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; + } + } + } + out[0] *= 18.24196194486065; + out[1] *= 18.24196194486065; + out[2] *= 18.24196194486065; + return out; + } + + @Override + public double[] getNoiseDerivativeRaw(long sl, double x, double y, double z) { + int seed = (int) sl; + // 3D OpenSimplex2S case uses two offset rotated cube grids. + final double R3 = (2.0 / 3.0); + double r = (x + y + z) * R3; // Rotation, not skew + x = r - x; + y = r - y; + z = r - z; + + + int i = (int) Math.floor(x); + int j = (int) Math.floor(y); + int k = (int) Math.floor(z); + double xi = x - i; + double yi = y - j; + double zi = z - k; + + i *= PRIME_X; + j *= PRIME_Y; + k *= PRIME_Z; + int seed2 = seed + 1293373; + + int xNMask = (int) (-0.5 - xi); + int yNMask = (int) (-0.5 - yi); + int zNMask = (int) (-0.5 - zi); + + double[] out = { 0.0f, 0.0f, 0.0f }; + + double x0 = xi + xNMask; + double y0 = yi + yNMask; + double z0 = zi + zNMask; + double a0 = 0.75 - x0 * x0 - y0 * y0 - z0 * z0; + double aa0 = a0 * a0, aaa0 = aa0 * a0, aaaa0 = aa0 * aa0; + int gi0 = gradCoordIndex(seed, i + (xNMask & PRIME_X), j + (yNMask & PRIME_Y), k + (zNMask & PRIME_Z)); + double gx0 = GRADIENTS_3D[gi0], gy0 = GRADIENTS_3D[gi0 | 1], gz0 = GRADIENTS_3D[gi0 | 2]; + double rampValue0 = gx0 * x0 + gy0 * y0 + gz0 * z0; + out[0] = aaaa0 * rampValue0; + out[1] = gx0 * aaaa0 - 8 * rampValue0 * aaa0 * x0; + out[2] = gy0 * aaaa0 - 8 * rampValue0 * aaa0 * y0; + out[3] = gz0 * aaaa0 - 8 * rampValue0 * aaa0 * z0; + + double x1 = xi - 0.5; + double y1 = yi - 0.5; + double z1 = zi - 0.5; + double a1 = 0.75 - x1 * x1 - y1 * y1 - z1 * z1; + double aa1 = a1 * a1, aaa1 = aa1 * a1, aaaa1 = aa1 * aa1; + int gi1 = gradCoordIndex(seed2, i + PRIME_X, j + PRIME_Y, k + PRIME_Z); + double gx1 = GRADIENTS_3D[gi1], gy1 = GRADIENTS_3D[gi1 | 1], gz1 = GRADIENTS_3D[gi1 | 2]; + double rampValue1 = gx1 * x1 + gy1 * y1 + gz1 * z1; + out[0] += aaaa1 * rampValue1; + out[1] += gx1 * aaaa1 - 8 * rampValue1 * aaa1 * x1; + out[2] += gy1 * aaaa1 - 8 * rampValue1 * aaa1 * y1; + out[3] += gz1 * aaaa1 - 8 * rampValue1 * aaa1 * z1; + + double xAFlipMask0 = ((xNMask | 1) << 1) * x1; + double yAFlipMask0 = ((yNMask | 1) << 1) * y1; + double zAFlipMask0 = ((zNMask | 1) << 1) * z1; + double xAFlipMask1 = (-2 - (xNMask << 2)) * x1 - 1.0; + double yAFlipMask1 = (-2 - (yNMask << 2)) * y1 - 1.0; + double zAFlipMask1 = (-2 - (zNMask << 2)) * z1 - 1.0; + + boolean skip5 = false; + double a2 = xAFlipMask0 + a0; + if(a2 > 0) { + double x2 = x0 - (xNMask | 1); + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i + (~xNMask & PRIME_X), j + (yNMask & PRIME_Y), k + (zNMask & PRIME_Z)); + double gx2 = GRADIENTS_3D[gi2], gy2 = GRADIENTS_3D[gi2 | 1], gz2 = GRADIENTS_3D[gi2 | 2]; + double rampValue2 = gx2 * x2 + gy2 * y0 + gz2 * z0; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y0; + out[3] += gz2 * aaaa2 - 8 * rampValue2 * aaa2 * z0; + } else { + double a3 = yAFlipMask0 + zAFlipMask0 + a0; + if(a3 > 0) { + double y3 = y0 - (yNMask | 1); + double z3 = z0 - (zNMask | 1); + double aa3 = a3 * a3, aaa3 = aa3 * a3, aaaa3 = aa3 * aa3; + int gi3 = gradCoordIndex(seed, i + (xNMask & PRIME_X), j + (~yNMask & PRIME_Y), k + (~zNMask & PRIME_Z)); + double gx3 = GRADIENTS_3D[gi3], gy3 = GRADIENTS_3D[gi3 | 1], gz3 = GRADIENTS_3D[gi3 | 2]; + double rampValue3 = gx3 * x0 + gy3 * y3 + gz3 * z3; + out[0] += aaaa3 * rampValue3; + out[1] += gx3 * aaaa3 - 8 * rampValue3 * aaa3 * x0; + out[2] += gy3 * aaaa3 - 8 * rampValue3 * aaa3 * y3; + out[3] += gz3 * aaaa3 - 8 * rampValue3 * aaa3 * z3; + } + + double a4 = xAFlipMask1 + a1; + if(a4 > 0) { + double x4 = (xNMask | 1) + x1; + double aa4 = a4 * a4, aaa4 = aa4 * a4, aaaa4 = aa4 * aa4; + int gi4 = gradCoordIndex(seed2, i + (xNMask & (PRIME_X << 1)), j + PRIME_Y, k + PRIME_Z); + double gx4 = GRADIENTS_3D[gi4], gy4 = GRADIENTS_3D[gi4 | 1], gz4 = GRADIENTS_3D[gi4 | 2]; + double rampValue4 = gx4 * x4 + gy4 * y1 + gz4 * z1; + out[0] += aaaa4 * rampValue4; + out[1] += gx4 * aaaa4 - 8 * rampValue4 * aaa4 * x4; + out[2] += gy4 * aaaa4 - 8 * rampValue4 * aaa4 * y1; + out[3] += gz4 * aaaa4 - 8 * rampValue4 * aaa4 * z1; + skip5 = true; + } + } + + boolean skip9 = false; + double a6 = yAFlipMask0 + a0; + if(a6 > 0) { + double y6 = y0 - (yNMask | 1); + double aa6 = a6 * a6, aaa6 = aa6 * a6, aaaa6 = aa6 * aa6; + int gi6 = gradCoordIndex(seed, i + (xNMask & PRIME_X), j + (~yNMask & PRIME_Y), k + (zNMask & PRIME_Z)); + double gx6 = GRADIENTS_3D[gi6], gy6 = GRADIENTS_3D[gi6 | 1], gz6 = GRADIENTS_3D[gi6 | 2]; + double rampValue6 = gx6 * x0 + gy6 * y6 + gz6 * z0; + out[0] += aaaa6 * rampValue6; + out[1] += gx6 * aaaa6 - 8 * rampValue6 * aaa6 * x0; + out[2] += gy6 * aaaa6 - 8 * rampValue6 * aaa6 * y6; + out[3] += gz6 * aaaa6 - 8 * rampValue6 * aaa6 * z0; + } else { + double a7 = xAFlipMask0 + zAFlipMask0 + a0; + if(a7 > 0) { + double x7 = x0 - (xNMask | 1); + double z7 = z0 - (zNMask | 1); + double aa7 = a7 * a7, aaa7 = aa7 * a7, aaaa7 = aa7 * aa7; + int gi7 = gradCoordIndex(seed, i + (~xNMask & PRIME_X), j + (yNMask & PRIME_Y), k + (~zNMask & PRIME_Z)); + double gx7 = GRADIENTS_3D[gi7], gy7 = GRADIENTS_3D[gi7 | 1], gz7 = GRADIENTS_3D[gi7 | 2]; + double rampValue7 = gx7 * x7 + gy7 * y0 + gz7 * z7; + out[0] += aaaa7 * rampValue7; + out[1] += gx7 * aaaa7 - 8 * rampValue7 * aaa7 * x7; + out[2] += gy7 * aaaa7 - 8 * rampValue7 * aaa7 * y0; + out[3] += gz7 * aaaa7 - 8 * rampValue7 * aaa7 * z7; + } + + double a8 = yAFlipMask1 + a1; + if(a8 > 0) { + double y8 = (yNMask | 1) + y1; + double aa8 = a8 * a8, aaa8 = aa8 * a8, aaaa8 = aa8 * aa8; + int gi8 = gradCoordIndex(seed2, i + PRIME_X, j + (yNMask & (PRIME_Y << 1)), k + PRIME_Z); + double gx8 = GRADIENTS_3D[gi8], gy8 = GRADIENTS_3D[gi8 | 1], gz8 = GRADIENTS_3D[gi8 | 2]; + double rampValue8 = gx8 * x1 + gy8 * y8 + gz8 * z1; + out[0] += aaaa8 * rampValue8; + out[1] += gx8 * aaaa8 - 8 * rampValue8 * aaa8 * x1; + out[2] += gy8 * aaaa8 - 8 * rampValue8 * aaa8 * y8; + out[3] += gz8 * aaaa8 - 8 * rampValue8 * aaa8 * z1; + skip9 = true; + } + } + + boolean skipD = false; + double aA = zAFlipMask0 + a0; + if(aA > 0) { + double zA = z0 - (zNMask | 1); + double aaA = aA * aA, aaaA = aaA * aA, aaaaA = aaA * aaA; + int giA = gradCoordIndex(seed, i + (xNMask & PRIME_X), j + (yNMask & PRIME_Y), k + (~zNMask & PRIME_Z)); + double gxA = GRADIENTS_3D[giA], gyA = GRADIENTS_3D[giA | 1], gzA = GRADIENTS_3D[giA | 2]; + double rampValueA = gxA * x0 + gyA * y0 + gzA * zA; + out[0] += aaaaA * rampValueA; + out[1] += gxA * aaaaA - 8 * rampValueA * aaaA * x0; + out[2] += gyA * aaaaA - 8 * rampValueA * aaaA * y0; + out[3] += gzA * aaaaA - 8 * rampValueA * aaaA * zA; + } else { + double aB = xAFlipMask0 + yAFlipMask0 + a0; + if(aB > 0) { + double xB = x0 - (xNMask | 1); + double yB = y0 - (yNMask | 1); + double aaB = aB * aB, aaaB = aaB * aB, aaaaB = aaB * aaB; + int giB = gradCoordIndex(seed, i + (~xNMask & PRIME_X), j + (~yNMask & PRIME_Y), k + (zNMask & PRIME_Z)); + double gxB = GRADIENTS_3D[giB], gyB = GRADIENTS_3D[giB | 1], gzB = GRADIENTS_3D[giB | 2]; + double rampValueB = gxB * xB + gyB * yB + gzB * z0; + out[0] += aaaaB * rampValueB; + out[1] += gxB * aaaaB - 8 * rampValueB * aaaB * xB; + out[2] += gyB * aaaaB - 8 * rampValueB * aaaB * yB; + out[3] += gzB * aaaaB - 8 * rampValueB * aaaB * z0; + } + + double aC = zAFlipMask1 + a1; + if(aC > 0) { + double zC = (zNMask | 1) + z1; + double aaC = aC * aC, aaaC = aaC * aC, aaaaC = aaC * aaC; + int giC = gradCoordIndex(seed2, i + PRIME_X, j + PRIME_Y, k + (zNMask & (PRIME_Z << 1))); + double gxC = GRADIENTS_3D[giC], gyC = GRADIENTS_3D[giC | 1], gzC = GRADIENTS_3D[giC | 2]; + double rampValueC = gxC * x1 + gyC * y1 + gzC * zC; + out[0] += aaaaC * rampValueC; + out[1] += gxC * aaaaC - 8 * rampValueC * aaaC * x1; + out[2] += gyC * aaaaC - 8 * rampValueC * aaaC * y1; + out[3] += gzC * aaaaC - 8 * rampValueC * aaaC * zC; + skipD = true; + } + } + + if(!skip5) { + double a5 = yAFlipMask1 + zAFlipMask1 + a1; + if(a5 > 0) { + double y5 = (yNMask | 1) + y1; + double z5 = (zNMask | 1) + z1; + double aa5 = a5 * a5, aaa5 = aa5 * a5, aaaa5 = aa5 * aa5; + int gi5 = gradCoordIndex(seed2, i + PRIME_X, j + (yNMask & (PRIME_Y << 1)), k + (zNMask & (PRIME_Z << 1))); + double gx5 = GRADIENTS_3D[gi5], gy5 = GRADIENTS_3D[gi5 | 1], gz5 = GRADIENTS_3D[gi5 | 2]; + double rampValue5 = gx5 * x1 + gy5 * y5 + gz5 * z5; + out[0] += aaaa5 * rampValue5; + out[1] += gx5 * aaaa5 - 8 * rampValue5 * aaa5 * x1; + out[2] += gy5 * aaaa5 - 8 * rampValue5 * aaa5 * y5; + out[3] += gz5 * aaaa5 - 8 * rampValue5 * aaa5 * z5; + } + } + + if(!skip9) { + double a9 = xAFlipMask1 + zAFlipMask1 + a1; + if(a9 > 0) { + double x9 = (xNMask | 1) + x1; + double z9 = (zNMask | 1) + z1; + double aa9 = a9 * a9, aaa9 = aa9 * a9, aaaa9 = aa9 * aa9; + int gi9 = gradCoordIndex(seed2, i + (xNMask & (PRIME_X << 1)), j + PRIME_Y, k + (zNMask & (PRIME_Z << 1))); + double gx9 = GRADIENTS_3D[gi9], gy9 = GRADIENTS_3D[gi9 | 1], gz9 = GRADIENTS_3D[gi9 | 2]; + double rampValue9 = gx9 * x9 + gy9 * y1 + gz9 * z9; + out[0] += aaaa9 * rampValue9; + out[1] += gx9 * aaaa9 - 8 * rampValue9 * aaa9 * x9; + out[2] += gy9 * aaaa9 - 8 * rampValue9 * aaa9 * y1; + out[3] += gz9 * aaaa9 - 8 * rampValue9 * aaa9 * z9; + } + } + + if(!skipD) { + double aD = xAFlipMask1 + yAFlipMask1 + a1; + if(aD > 0) { + double xD = (xNMask | 1) + x1; + double yD = (yNMask | 1) + y1; + double aaD = aD * aD, aaaD = aaD * aD, aaaaD = aaD * aaD; + int giD = gradCoordIndex(seed2, i + (xNMask & (PRIME_X << 1)), j + (yNMask & (PRIME_Y << 1)), k + PRIME_Z); + double gxD = GRADIENTS_3D[giD], gyD = GRADIENTS_3D[giD | 1], gzD = GRADIENTS_3D[giD | 2]; + double rampValueD = gxD * xD + gyD * yD + gzD * z1; + out[0] += aaaaD * rampValueD; + out[1] += gxD * aaaaD - 8 * rampValueD * aaaD * xD; + out[2] += gyD * aaaaD - 8 * rampValueD * aaaD * yD; + out[3] += gzD * aaaaD - 8 * rampValueD * aaaD * z1; + } + } + + out[0] *= 9.046026385208288; + out[1] *= 9.046026385208288; + out[2] *= 9.046026385208288; + out[3] *= 9.046026385208288; + return out; + } } 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 eda599a34..a5fd3f3bf 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 @@ -7,13 +7,14 @@ package com.dfsek.terra.addons.noise.samplers.noise.simplex; +import com.dfsek.terra.addons.noise.samplers.noise.DerivativeNoiseFunction; import com.dfsek.terra.addons.noise.samplers.noise.NoiseFunction; /** * Abstract NoiseSampler implementation for simplex-style noise functions. */ -public abstract class SimplexStyleSampler extends NoiseFunction { +public abstract class SimplexStyleSampler extends DerivativeNoiseFunction { protected static final double[] GRADIENTS_2_D = { 0.130526192220052d, 0.99144486137381d, 0.38268343236509d, 0.923879532511287d, 0.608761429008721d, 0.793353340291235d, 0.793353340291235d, 0.608761429008721d, 0.923879532511287d, 0.38268343236509d, 0.99144486137381d, 0.130526192220051d, @@ -79,26 +80,53 @@ public abstract class SimplexStyleSampler extends NoiseFunction { 1, 1, 0, 0, 0, -1, 1, 0, -1, 1, 0, 0, 0, -1, -1, 0 }; - protected static double gradCoord(int seed, int xPrimed, int yPrimed, double xd, double yd) { + protected static int gradCoordIndex(int seed, int xPrimed, int yPrimed) { int hash = hash(seed, xPrimed, yPrimed); hash ^= hash >> 15; hash &= 127 << 1; - double xg = GRADIENTS_2_D[hash]; - double yg = GRADIENTS_2_D[hash | 1]; + return hash; + } + + protected static double gradCoord(int seed, int xPrimed, int yPrimed, double xd, double yd) { + int index = gradCoordIndex(seed, xPrimed, yPrimed); + + double xg = GRADIENTS_2_D[index]; + double yg = GRADIENTS_2_D[index | 1]; return xd * xg + yd * yg; } - protected static double gradCoord(int seed, int xPrimed, int yPrimed, int zPrimed, double xd, double yd, double zd) { + protected static int gradCoordIndex(int seed, int xPrimed, int yPrimed, int zPrimed) { int hash = hash(seed, xPrimed, yPrimed, zPrimed); hash ^= hash >> 15; hash &= 63 << 2; - double xg = GRADIENTS_3D[hash]; - double yg = GRADIENTS_3D[hash | 1]; - double zg = GRADIENTS_3D[hash | 2]; + return hash; + } + + protected static double gradCoord(int seed, int xPrimed, int yPrimed, int zPrimed, double xd, double yd, double zd) { + int index = gradCoordIndex(seed, xPrimed, yPrimed, zPrimed); + + double xg = GRADIENTS_3D[index]; + double yg = GRADIENTS_3D[index | 1]; + double zg = GRADIENTS_3D[index | 2]; return xd * xg + yd * yg + zd * zg; } + + @Override + public double[] getNoiseDerivativeRaw(long seed, double x, double y) { + return new double[]{0, 0, 0}; + } + + @Override + public double[] getNoiseDerivativeRaw(long seed, double x, double y, double z) { + return new double[]{0, 0, 0, 0}; + } + + @Override + public boolean isDifferentiable() { + return false; + } } From 5b35eb041b286eb0c910fe79ca7525fdc6389b32 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 19:43:56 -0600 Subject: [PATCH 37/56] Remove temp DerivativeFractl nose --- .../noise/DerivativeFractalTemplate.java | 31 ----- .../noise/simplex/DerivativeFractal.java | 122 ------------------ 2 files changed, 153 deletions(-) delete mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java delete mode 100644 common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java deleted file mode 100644 index 68e8c803d..000000000 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/DerivativeFractalTemplate.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.dfsek.terra.addons.noise.config.templates.noise; - -import com.dfsek.tectonic.api.config.template.annotations.Default; -import com.dfsek.tectonic.api.config.template.annotations.Value; - -import com.dfsek.terra.addons.noise.config.templates.SamplerTemplate; -import com.dfsek.terra.addons.noise.samplers.noise.simplex.DerivativeFractal; - - -public class DerivativeFractalTemplate extends DerivativeNoiseTemplate { - - @Value("octaves") - @Default - private int octaves = 3; - - @Value("gain") - @Default - private double gain = 0.5; - - @Value("lacunarity") - @Default - private double lacunarity = 2.0; - - @Override - public DerivativeFractal get() { - DerivativeFractal derivativeFractal = new DerivativeFractal(octaves, gain, lacunarity); - derivativeFractal.setFrequency(frequency); - derivativeFractal.setSalt(salt); - return derivativeFractal; - } -} diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java deleted file mode 100644 index 9a9e7f922..000000000 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/DerivativeFractal.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.dfsek.terra.addons.noise.samplers.noise.simplex; - -import com.dfsek.terra.addons.noise.samplers.noise.DerivativeNoiseFunction; - -import static com.dfsek.terra.addons.noise.samplers.noise.PseudoErosionSampler.dot; - - -/** - * Temporary sampler that provides derivatives to test pseudoerosion, should be replaced with - * derivative versions of existing samplers - */ -public class DerivativeFractal extends DerivativeNoiseFunction { - - private final int heightOctaves; - private final double heightGain; - private final double heightLacunarity; - private static final float HASH_X = 0.3183099f; - private static final float HASH_Y = 0.3678794f; - - public DerivativeFractal(int octaves, double gain, double lacunarity) { - this.heightOctaves = octaves; - this.heightGain = gain; - this.heightLacunarity = lacunarity; - } - - public static float hash(float x, float y) { - float xx = x * HASH_X + HASH_Y; - float yy = y * HASH_Y + HASH_X; - - // Swapped the components here - return 16 * (xx * yy * (xx + yy)); - } - - public static float hashX(float n) { - // Swapped the components here - float nx = HASH_X * n; - return -1.0f + 2.0f * fract(nx); - } - - public static float hashY(float n) { - float ny = HASH_Y * n; - return -1.0f + 2.0f * fract(ny); - } - - public static float fract(float x) { - return (x - (float)Math.floor(x)); - } - - private static float[] baseNoise(float px, float py) { - float ix = (float)Math.floor(px); - float iy = (float)Math.floor(py); - float fx = px - ix; - float fy = py - iy; - - float ux = fx * fx * fx * (fx * (fx * 6.0f - 15.0f) + 10.0f); - float uy = fy * fy * fy * (fy * (fy * 6.0f - 15.0f) + 10.0f); - float dux = fx * fx * 30.0f * (fx * (fx - 2.0f) + 1.0f); - float duy = fy * fy * 30.0f * (fy * (fy - 2.0f) + 1.0f); - - float gan = hash(ix, iy); - float gax = hashX(gan); - float gay = hashY(gan); - - float gbn = hash(ix + 1, iy); - float gbx = hashX(gbn); - float gby = hashY(gbn); - - float gcn = hash(ix, iy + 1); - float gcx = hashX(gcn); - float gcy = hashY(gcn); - - float gdn = hash(ix + 1, iy + 1); - float gdx = hashX(gdn); - float gdy = hashY(gdn); - - float va = dot(gax, gay, fx, fy); - float vb = dot(gbx, gby, fx - 1, fy); - float vc = dot(gcx, gcy, fx, fy - 1); - float vd = dot(gdx, gdy, fx - 1, fy - 1); - - float u2x = gax + (gbx - gax) * ux + (gcx - gax) * uy + (gax - gbx - gcx + gdx) * ux * uy + dux * (uy * (va - vb - vc + vd) + vb - va); - float u2y = gay + (gby - gay) * ux + (gcy - gay) * uy + (gay - gby - gcy + gdy) * ux * uy + duy * (ux * (va - vb - vc + vd) + vc - va); - - return new float[] { va + ux * (vb - va) + uy * (vc - va) + ux * uy * (va - vb - vc + vd), u2x, u2y }; - } - - @Override - public double[] getNoiseDerivativeRaw(long seed, double x, double y) { - double[] out = { 0.0f, 0.0f, 0.0f }; - float heightFreq = 1.0f; - float heightAmp = 1f; - float cumAmp = 0.0f; - for (int i = 0; i < heightOctaves; i++) { - float[] noise = baseNoise((float) (x * heightFreq), (float) (y * heightFreq)); - out[0] += noise[0] * heightAmp; - out[1] += noise[1] * heightAmp * heightFreq; - out[2] += noise[2] * heightAmp * heightFreq; - cumAmp += heightAmp; - heightAmp *= heightGain; - heightFreq *= heightLacunarity; - } - out[0] /= cumAmp; - out[1] /= cumAmp; - out[2] /= cumAmp; - return out; - } - - @Override - public double[] getNoiseDerivativeRaw(long seed, double x, double y, double z) { - return getNoiseDerivativeRaw(seed, x, y); - } - - @Override - public double getNoiseRaw(long seed, double x, double y) { - return getNoiseDerivativeRaw(seed, x, y)[0]; - } - - @Override - public double getNoiseRaw(long seed, double x, double y, double z) { - return getNoiseRaw(seed, x, y); - } -} From 5f340f8ffdbf26253b6a42604a5b80f66230f00d Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 19:48:22 -0600 Subject: [PATCH 38/56] slight open simplex 2s op\pt --- .../noise/simplex/OpenSimplex2Sampler.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java index e4da85a5b..d3e80cc7e 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java @@ -37,41 +37,37 @@ public double getNoiseRaw(long sl, double x, double y) { i *= PRIME_X; j *= PRIME_Y; - double n0, n1, n2; + double value = 0; double a = 0.5 - x0 * x0 - y0 * y0; - if(a <= 0) n0 = 0; - else { - n0 = (a * a) * (a * a) * gradCoord(seed, i, j, x0, y0); + if(a > 0) { + value = (a * a) * (a * a) * gradCoord(seed, i, j, x0, y0); } double c = 2 * (1 - 2 * G2) * (1 / G2 - 2) * t + ((-2 * (1 - 2 * G2) * (1 - 2 * G2)) + a); - if(c <= 0) n2 = 0; - else { + if(c > 0) { double x2 = x0 + (2 * G2 - 1); double y2 = y0 + (2 * G2 - 1); - n2 = (c * c) * (c * c) * gradCoord(seed, i + PRIME_X, j + PRIME_Y, x2, y2); + value += (c * c) * (c * c) * gradCoord(seed, i + PRIME_X, j + PRIME_Y, x2, y2); } if(y0 > x0) { double x1 = x0 + G2; double y1 = y0 + (G2 - 1); double b = 0.5 - x1 * x1 - y1 * y1; - if(b <= 0) n1 = 0; - else { - n1 = (b * b) * (b * b) * gradCoord(seed, i, j + PRIME_Y, x1, y1); + if(b > 0) { + value += (b * b) * (b * b) * gradCoord(seed, i, j + PRIME_Y, x1, y1); } } else { double x1 = x0 + (G2 - 1); double y1 = y0 + G2; double b = 0.5 - x1 * x1 - y1 * y1; - if(b <= 0) n1 = 0; - else { - n1 = (b * b) * (b * b) * gradCoord(seed, i + PRIME_X, j, x1, y1); + if(b <= 0) { + value += (b * b) * (b * b) * gradCoord(seed, i + PRIME_X, j, x1, y1); } } - return (n0 + n1 + n2) * 99.83685446303647f; + return value * 99.83685446303647f; } @Override From 017b4608bcb149221d61992c053c43aacfac190f Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 19:49:16 -0600 Subject: [PATCH 39/56] Fix build --- .../src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java index 59fc635a6..16e1d8040 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java @@ -97,8 +97,7 @@ public void initialize() { noiseRegistry.register(addon.key("SIMPLEX"), () -> new SimpleNoiseTemplate(SimplexSampler::new)); noiseRegistry.register(addon.key("GABOR"), GaborNoiseTemplate::new); noiseRegistry.register(addon.key("PSEUDOEROSION"), PseudoErosionTemplate::new); - noiseRegistry.register(addon.key("DERIVATIVE"), DerivativeFractalTemplate::new); - + noiseRegistry.register(addon.key("VALUE"), () -> new SimpleNoiseTemplate(ValueSampler::new)); noiseRegistry.register(addon.key("VALUE_CUBIC"), () -> new SimpleNoiseTemplate(ValueCubicSampler::new)); From bd73427072ad5a23fb8eb13041711cfbbb95a1c3 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 20:29:41 -0600 Subject: [PATCH 40/56] OpenSimplex 2 Derivative Impl --- .../noise/simplex/OpenSimplex2SSampler.java | 2 +- .../noise/simplex/OpenSimplex2Sampler.java | 199 ++++++++++++++++++ 2 files changed, 200 insertions(+), 1 deletion(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java index d9aec851e..ef81ff139 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java @@ -479,7 +479,7 @@ public double[] getNoiseDerivativeRaw(long sl, double x, double y, double z) { int yNMask = (int) (-0.5 - yi); int zNMask = (int) (-0.5 - zi); - double[] out = { 0.0f, 0.0f, 0.0f }; + double[] out = { 0.0f, 0.0f, 0.0f, 0.0f }; double x0 = xi + xNMask; double y0 = yi + yNMask; diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java index d3e80cc7e..443146a9b 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java @@ -153,4 +153,203 @@ public double getNoiseRaw(long sl, double x, double y, double z) { return value * 32.69428253173828125; } + + @Override + public boolean isDifferentiable() { + return true; + } + + @Override + public double[] getNoiseDerivativeRaw(long sl, double x, double y) { + int seed = (int) sl; + // 2D OpenSimplex2 case uses the same algorithm as ordinary Simplex. + final double G2 = (3 - SQRT3) / 6; + + final double F2 = 0.5f * (SQRT3 - 1); + double s = (x + y) * F2; + x += s; + y += s; + + + int i = (int) Math.floor(x); + int j = (int) Math.floor(y); + double xi = x - i; + double yi = y - j; + + double t = (xi + yi) * G2; + double x0 = xi - t; + double y0 = yi - t; + + i *= PRIME_X; + j *= PRIME_Y; + + double[] out = { 0.0f, 0.0f, 0.0f }; + + double a = 0.5 - x0 * x0 - y0 * y0; + if(a > 0) { + double aa = a * a, aaa = aa * a, aaaa = aa * aa; + int gi = gradCoordIndex(seed, i, j); + double gx = GRADIENTS_2_D[gi], gy = GRADIENTS_2_D[gi | 1]; + double rampValue = gx * x0 + gy * y0; + out[0] += aaaa * rampValue; + out[1] += gx * aaaa - 8 * rampValue * aaa * x0; + out[2] += gy * aaaa - 8 * rampValue * aaa * y0; + } + + double c = 2 * (1 - 2 * G2) * (1 / G2 - 2) * t + ((-2 * (1 - 2 * G2) * (1 - 2 * G2)) + a); + if(c > 0) { + double x2 = x0 + (2 * G2 - 1); + double y2 = y0 + (2 * G2 - 1); + double cc = c * c, ccc = cc * c, cccc = cc * cc; + int gi = gradCoordIndex(seed, i + PRIME_X, j + PRIME_Y); + double gx = GRADIENTS_2_D[gi], gy = GRADIENTS_2_D[gi | 1]; + double rampValue = gx * x2 + gy * y2; + out[0] += cccc * rampValue; + out[1] += gx * cccc - 8 * rampValue * ccc * x2; + out[2] += gy * cccc - 8 * rampValue * ccc * y2; } + + if(y0 > x0) { + double x1 = x0 + G2; + double y1 = y0 + (G2 - 1); + double b = 0.5 - x1 * x1 - y1 * y1; + if(b > 0) { + double bb = b * b, bbb = bb * b, bbbb = bb * bb; + int gi = gradCoordIndex(seed, i, j + PRIME_Y); + double gx = GRADIENTS_2_D[gi], gy = GRADIENTS_2_D[gi | 1]; + double rampValue = gx * x1 + gy * y1; + out[0] += bbbb * rampValue; + out[1] += gx * bbbb - 8 * rampValue * bbb * x1; + out[2] += gy * bbbb - 8 * rampValue * bbb * y1; } + } else { + double x1 = x0 + (G2 - 1); + double y1 = y0 + G2; + double b = 0.5 - x1 * x1 - y1 * y1; + if(b > 0) { + double bb = b * b, bbb = bb * b, bbbb = bb * bb; + int gi = gradCoordIndex(seed, i + PRIME_X, j); + double gx = GRADIENTS_2_D[gi], gy = GRADIENTS_2_D[gi | 1]; + double rampValue = gx * x1 + gy * y1; + out[0] += bbbb * rampValue; + out[1] += gx * bbbb - 8 * rampValue * bbb * x1; + out[2] += gy * bbbb - 8 * rampValue * bbb * y1; } + } + + out[0] *= 99.83685446303647f; + out[1] *= 99.83685446303647f; + out[2] *= 99.83685446303647f; + return out; + } + + @Override + public double[] getNoiseDerivativeRaw(long sl, double x, double y, double z) { + int seed = (int) sl; + // 3D OpenSimplex2Sampler case uses two offset rotated cube grids. + final double R3 = (2.0 / 3.0); + double r = (x + y + z) * R3; // Rotation, not skew + x = r - x; + y = r - y; + z = r - z; + + + int i = (int) Math.round(x); + int j = (int) Math.round(y); + int k = (int) Math.round(z); + double x0 = x - i; + double y0 = y - j; + double z0 = z - k; + + int xNSign = (int) (-1.0 - x0) | 1; + int yNSign = (int) (-1.0 - y0) | 1; + int zNSign = (int) (-1.0 - z0) | 1; + + double ax0 = xNSign * -x0; + double ay0 = yNSign * -y0; + double az0 = zNSign * -z0; + + i *= PRIME_X; + j *= PRIME_Y; + k *= PRIME_Z; + + double[] out = { 0.0f, 0.0f, 0.0f, 0.0f }; + double a = (0.6f - x0 * x0) - (y0 * y0 + z0 * z0); + + for(int l = 0; ; l++) { + if(a > 0) { + double aa = a * a, aaa = aa * a, aaaa = aa * aa; + int gi = gradCoordIndex(seed, i, j, k); + double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; + double rampValue = gx * x0 + gy * y0 + gz * z0; + out[0] += aaaa * rampValue; + out[1] += gx * aaaa - 8 * rampValue * aaa * x0; + out[1] += gy * aaaa - 8 * rampValue * aaa * y0; + out[2] += gz * aaaa - 8 * rampValue * aaa * z0; + } + + if(ax0 >= ay0 && ax0 >= az0) { + double b = a + ax0 + ax0; + if(b > 1) { + b -= 1; + double bb = b * b, bbb = bb * b, bbbb = bb * bb; + int gi = gradCoordIndex(seed, i - xNSign * PRIME_X, j, k); + double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; + double rampValue = gx * (x0 + xNSign) + gy * y0 + gz * z0; + out[0] += bbbb * rampValue; + out[1] += gx * bbbb - 8 * rampValue * bbb * (x0 + xNSign); + out[1] += gy * bbbb - 8 * rampValue * bbb * y0; + out[2] += gz * bbbb - 8 * rampValue * bbb * z0; + } + } else if(ay0 > ax0 && ay0 >= az0) { + double b = a + ay0 + ay0; + if(b > 1) { + b -= 1; + double bb = b * b, bbb = bb * b, bbbb = bb * bb; + int gi = gradCoordIndex(seed, i, j - yNSign * PRIME_Y, k); + double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; + double rampValue = gx * x0 + gy * (y0 + yNSign) + gz * z0; + out[0] += bbbb * rampValue; + out[1] += gx * bbbb - 8 * rampValue * bbb * x0; + out[1] += gy * bbbb - 8 * rampValue * bbb * (y0 + yNSign); + out[2] += gz * bbbb - 8 * rampValue * bbb * z0; } + } else { + double b = a + az0 + az0; + if(b > 1) { + b -= 1; + double bb = b * b, bbb = bb * b, bbbb = bb * bb; + int gi = gradCoordIndex(seed, i, j, k - zNSign * PRIME_Z); + double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; + double rampValue = gx * x0 + gy * y0 + gz * (z0 + zNSign); + out[0] += bbbb * rampValue; + out[1] += gx * bbbb - 8 * rampValue * bbb * x0; + out[1] += gy * bbbb - 8 * rampValue * bbb * y0; + out[2] += gz * bbbb - 8 * rampValue * bbb * (z0 + zNSign); } + } + + if(l == 1) break; + + ax0 = 0.5 - ax0; + ay0 = 0.5 - ay0; + az0 = 0.5 - az0; + + x0 = xNSign * ax0; + y0 = yNSign * ay0; + z0 = zNSign * az0; + + a += (0.75 - ax0) - (ay0 + az0); + + i += (xNSign >> 1) & PRIME_X; + j += (yNSign >> 1) & PRIME_Y; + k += (zNSign >> 1) & PRIME_Z; + + xNSign = -xNSign; + yNSign = -yNSign; + zNSign = -zNSign; + + seed = ~seed; + } + out[0] *= 32.69428253173828125; + out[1] *= 32.69428253173828125; + out[2] *= 32.69428253173828125; + out[3] *= 32.69428253173828125; + return out; + } } From 1d05f95f746639fdbc4c242d84aa4fcd93d666f4 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 20:38:22 -0600 Subject: [PATCH 41/56] Sin/Cos Opts --- .../com/dfsek/terra/api/util/MathUtil.java | 58 +++++++++++-------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java index e57765f2e..87ad9159d 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java @@ -18,41 +18,51 @@ public final class MathUtil { * Epsilon for fuzzy floating point comparisons. */ public static final double EPSILON = 1.0E-5; - private static final int SIN_BITS, SIN_MASK, SIN_COUNT; - private static final double radFull, radToIndex; - private static final double degFull, degToIndex; - private static final double[] sin, cos; - static { - SIN_BITS = 12; - SIN_MASK = ~(-1 << SIN_BITS); - SIN_COUNT = SIN_MASK + 1; + private static final int lookupBits = 14; - radFull = Math.PI * 2.0; - degFull = 360.0; - radToIndex = SIN_COUNT / radFull; - degToIndex = SIN_COUNT / degFull; + static final int lookupTableSize = 1 << lookupBits; - sin = new double[SIN_COUNT]; - cos = new double[SIN_COUNT]; + private static final int lookupTableSizeWithMargin = lookupTableSize + 1; + private static final double tauOverLookupSize = TrigonometryConstants.TAU / lookupTableSize; + static final double radianToIndex = (~(-1 << lookupBits) + 1) / TrigonometryConstants.TAU; + private static final long[] sinTable; - for(int i = 0; i < SIN_COUNT; i++) { - sin[i] = Math.sin((i + 0.5f) / SIN_COUNT * radFull); - cos[i] = Math.cos((i + 0.5f) / SIN_COUNT * radFull); + static { + sinTable = new long[lookupTableSizeWithMargin]; + for (int i = 0; i < lookupTableSizeWithMargin; i++) { + double d = i * tauOverLookupSize; + sinTable[i] = Double.doubleToRawLongBits(StrictMath.sin(d)); } + } - // Four cardinal directions (credits: Nate) - for(int i = 0; i < 360; i += 90) { - sin[(int) (i * degToIndex) & SIN_MASK] = Math.sin(i * Math.PI / 180.0); - cos[(int) (i * degToIndex) & SIN_MASK] = Math.cos(i * Math.PI / 180.0); - } + static double sinLookup(long index) { + // Trigonometric identity: sin(-x) = -sin(x) + // Given a domain of 0 <= x <= 2*pi, just negate the value if x > pi. + // This allows the sin table size to be halved. + long neg = (index & 0x8000000000000000L) << 32; + + // All bits set if (pi/2 <= x), none set otherwise + // Extracts the 31st bit from 'half' + long mask = (index << 33) >> 63; + + // Trigonometric identity: sin(x) = sin(pi/2 - x) + long pos = (0x8000000000000001L & mask) + (index ^ mask); + + // Wrap the position in the table. Moving this down to immediately before the array access + // seems to help the Hotspot compiler optimize the bit math better. + pos &= 0x7fffffffffffffffL; + + // Fetch the corresponding value from the LUT and invert the sign bit as needed + // This directly manipulate the sign bit on the double bits to simplify logic + return Double.longBitsToDouble(sinTable[(int) pos] ^ neg); } public static double sin(double rad) { - return sin[(int) (rad * radToIndex) & SIN_MASK]; + return sinLookup((long) (rad * radianToIndex) & 0xFFFFFFFFL); } public static double cos(double rad) { - return cos[(int) (rad * radToIndex) & SIN_MASK]; + return sinLookup((long) (rad * radianToIndex + lookupTableSize) & 0xFFFFFFFFL); } public static double tan(double rad) { From 10d723372daf14bc551159d050412c71c7f69a76 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 20:45:47 -0600 Subject: [PATCH 42/56] Fix build --- .../api/src/main/java/com/dfsek/terra/api/util/MathUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java index 87ad9159d..0dbe5bb23 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java @@ -23,8 +23,8 @@ public final class MathUtil { static final int lookupTableSize = 1 << lookupBits; private static final int lookupTableSizeWithMargin = lookupTableSize + 1; - private static final double tauOverLookupSize = TrigonometryConstants.TAU / lookupTableSize; - static final double radianToIndex = (~(-1 << lookupBits) + 1) / TrigonometryConstants.TAU; + private static final double tauOverLookupSize = Math.TAU / lookupTableSize; + static final double radianToIndex = (~(-1 << lookupBits) + 1) / Math.TAU; private static final long[] sinTable; static { From f469193909f4d540e5f0d778359114daf392ac18 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 20:51:00 -0600 Subject: [PATCH 43/56] Make seed affect pseudoerosion hasing --- .../samplers/noise/PseudoErosionSampler.java | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java index 7aeff49ac..0b96ea517 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java @@ -47,22 +47,14 @@ public PseudoErosionSampler(int octaves, double gain, double lacunarity, double this.maxCellDistSqRecip = 1 / maxCellDistSq; } - public static float hash(float x, float y) { - float xx = x * HASH_X + HASH_Y; - float yy = y * HASH_Y + HASH_X; - - // Swapped the components here - return 16 * (xx * yy * (xx + yy)); - } - - public static float hashX(float n) { + public static float hashX(float seed, float n) { // Swapped the components here - float nx = HASH_X * n; + float nx = HASH_X * n * seed; return -1.0f + 2.0f * fract(nx); } - public static float hashY(float n) { - float ny = HASH_Y * n; + public static float hashY(float seed, float n) { + float ny = HASH_Y * n * seed; return -1.0f + 2.0f * fract(ny); } @@ -70,7 +62,7 @@ public static float fract(float x) { return (x - (float)Math.floor(x)); } - public float[] erosion(float x, float y, float dirX, float dirY) { + public float[] erosion(int seed, float x, float y, float dirX, float dirY) { int gridX = Math.round(x); int gridY = Math.round(y); float noise = 0.0f; @@ -80,10 +72,9 @@ public float[] erosion(float x, float y, float dirX, float dirY) { for (int cellX = gridX - 1; cellX <= gridX + 1; cellX++) { for (int cellY = gridY - 1; cellY <= gridY + 1; cellY++) { - // TODO - Make seed affect hashing - float cellHash = hash(cellX, cellY); - float cellOffsetX = (float) (hashX(cellHash) * jitter); - float cellOffsetY = (float) (hashY(cellHash) * jitter); + float cellHash = hash(seed, cellX, cellY); + float cellOffsetX = (float) (hashX(seed, cellHash) * jitter); + float cellOffsetY = (float) (hashY(seed, cellHash) * jitter); float cellOriginDeltaX = (x - cellX) + cellOffsetX; float cellOriginDeltaY = (y - cellY) + cellOffsetY; float cellOriginDistSq = cellOriginDeltaX * cellOriginDeltaX + cellOriginDeltaY * cellOriginDeltaY; @@ -135,7 +126,7 @@ public float heightMap(long seed, float x, float y) { // Stack erosion octaves for (int i = 0; i < octaves; i++) { - float[] erosionResult = erosion( + float[] erosionResult = erosion((int) seed, x * freq * (float) erosionFrequency, y * freq * (float) erosionFrequency, baseDirX + dirY * (float) branchStrength, From d6772f51eaa7c5c039accdcc000a7fd0f18706c6 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 20:56:13 -0600 Subject: [PATCH 44/56] Reformat --- .../addons/biome/extrusion/api/Extrusion.java | 4 +- .../pipeline/api/delegate/SelfDelegate.java | 4 +- .../biome/holder/PaletteHolderBuilder.java | 4 +- .../distributors/PointSetDistributor.java | 4 +- .../dfsek/terra/addons/noise/NoiseAddon.java | 43 ++- .../addons/noise/NoiseConfigPackTemplate.java | 6 +- .../DerivativeNoiseSamplerTemplate.java | 3 +- .../templates/ImageSamplerTemplate.java | 9 +- .../noise/PseudoErosionTemplate.java | 19 +- .../noise/DerivativeNoiseFunction.java | 1 + .../samplers/noise/PseudoErosionSampler.java | 55 +-- .../noise/simplex/OpenSimplex2SSampler.java | 334 +++++++++--------- .../noise/simplex/OpenSimplex2Sampler.java | 209 +++++------ .../noise/simplex/SimplexStyleSampler.java | 5 +- .../feature/FeatureGenerationAddon.java | 10 +- .../feature/FeatureGenerationStage.java | 6 +- .../structure/mutator/MutatedStructure.java | 4 +- .../addons/terrascript/parser/ParserUtil.java | 8 +- .../builders/CheckBlockFunctionBuilder.java | 4 +- .../api/noise/DerivativeNoiseSampler.java | 6 +- .../com/dfsek/terra/api/util/MathUtil.java | 2 +- .../world/biome/generation/BiomeProvider.java | 12 +- .../preprocessor/MetaNumberPreprocessor.java | 7 +- .../event/FunctionalEventHandlerImpl.java | 17 +- .../com/dfsek/terra/bukkit/BukkitEntity.java | 6 +- .../bukkit/world/BukkitWorldProperties.java | 4 +- .../terra/lifecycle/LifecycleEntryPoint.java | 6 +- .../mixin/lifecycle/MinecraftServerMixin.java | 1 + .../terra/lifecycle/util/LifecycleUtil.java | 1 + 29 files changed, 411 insertions(+), 383 deletions(-) diff --git a/common/addons/biome-provider-extrusion/src/main/java/com/dfsek/terra/addons/biome/extrusion/api/Extrusion.java b/common/addons/biome-provider-extrusion/src/main/java/com/dfsek/terra/addons/biome/extrusion/api/Extrusion.java index 4c4ca972a..c1d5f5524 100644 --- a/common/addons/biome-provider-extrusion/src/main/java/com/dfsek/terra/addons/biome/extrusion/api/Extrusion.java +++ b/common/addons/biome-provider-extrusion/src/main/java/com/dfsek/terra/addons/biome/extrusion/api/Extrusion.java @@ -1,9 +1,9 @@ package com.dfsek.terra.addons.biome.extrusion.api; -import java.util.Collection; - import com.dfsek.terra.api.world.biome.Biome; +import java.util.Collection; + public interface Extrusion { Biome extrude(Biome original, int x, int y, int z, long seed); diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/delegate/SelfDelegate.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/delegate/SelfDelegate.java index c6762334a..6b62818d2 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/delegate/SelfDelegate.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/delegate/SelfDelegate.java @@ -1,10 +1,10 @@ package com.dfsek.terra.addons.biome.pipeline.api.delegate; -import com.dfsek.terra.api.world.biome.Biome; - import java.util.Collections; import java.util.Set; +import com.dfsek.terra.api.world.biome.Biome; + final class SelfDelegate implements BiomeDelegate { public static final SelfDelegate INSTANCE = new SelfDelegate(); diff --git a/common/addons/config-biome/src/main/java/com/dfsek/terra/addons/biome/holder/PaletteHolderBuilder.java b/common/addons/config-biome/src/main/java/com/dfsek/terra/addons/biome/holder/PaletteHolderBuilder.java index e840f9817..a96cbcc48 100644 --- a/common/addons/config-biome/src/main/java/com/dfsek/terra/addons/biome/holder/PaletteHolderBuilder.java +++ b/common/addons/config-biome/src/main/java/com/dfsek/terra/addons/biome/holder/PaletteHolderBuilder.java @@ -7,11 +7,11 @@ package com.dfsek.terra.addons.biome.holder; +import com.dfsek.terra.api.world.chunk.generation.util.Palette; + import java.util.Map; import java.util.TreeMap; -import com.dfsek.terra.api.world.chunk.generation.util.Palette; - public class PaletteHolderBuilder { private final TreeMap paletteMap = new TreeMap<>(); diff --git a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PointSetDistributor.java b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PointSetDistributor.java index f85d41e5f..4285af486 100644 --- a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PointSetDistributor.java +++ b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PointSetDistributor.java @@ -7,11 +7,11 @@ package com.dfsek.terra.addons.feature.distributor.distributors; -import java.util.Set; - import com.dfsek.terra.addons.feature.distributor.util.Point; import com.dfsek.terra.api.structure.feature.Distributor; +import java.util.Set; + public class PointSetDistributor implements Distributor { private final Set points; diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java index 16e1d8040..3fd52950c 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseAddon.java @@ -9,17 +9,46 @@ import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.function.Supplier; + import com.dfsek.terra.addons.manifest.api.AddonInitializer; import com.dfsek.terra.addons.noise.config.CubicSplinePointTemplate; import com.dfsek.terra.addons.noise.config.DimensionApplicableNoiseSampler; -import com.dfsek.terra.addons.noise.config.templates.*; -import com.dfsek.terra.addons.noise.config.templates.noise.*; +import com.dfsek.terra.addons.noise.config.templates.BinaryArithmeticTemplate; +import com.dfsek.terra.addons.noise.config.templates.DerivativeNoiseSamplerTemplate; +import com.dfsek.terra.addons.noise.config.templates.DomainWarpTemplate; +import com.dfsek.terra.addons.noise.config.templates.FunctionTemplate; +import com.dfsek.terra.addons.noise.config.templates.ImageSamplerTemplate; +import com.dfsek.terra.addons.noise.config.templates.KernelTemplate; +import com.dfsek.terra.addons.noise.config.templates.LinearHeightmapSamplerTemplate; +import com.dfsek.terra.addons.noise.config.templates.TranslateSamplerTemplate; +import com.dfsek.terra.addons.noise.config.templates.noise.CellularNoiseTemplate; +import com.dfsek.terra.addons.noise.config.templates.noise.ConstantNoiseTemplate; +import com.dfsek.terra.addons.noise.config.templates.noise.DistanceSamplerTemplate; +import com.dfsek.terra.addons.noise.config.templates.noise.ExpressionFunctionTemplate; +import com.dfsek.terra.addons.noise.config.templates.noise.GaborNoiseTemplate; +import com.dfsek.terra.addons.noise.config.templates.noise.PseudoErosionTemplate; +import com.dfsek.terra.addons.noise.config.templates.noise.SimpleNoiseTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.fractal.BrownianMotionTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.fractal.PingPongTemplate; import com.dfsek.terra.addons.noise.config.templates.noise.fractal.RidgedFractalTemplate; -import com.dfsek.terra.addons.noise.config.templates.normalizer.*; +import com.dfsek.terra.addons.noise.config.templates.normalizer.ClampNormalizerTemplate; +import com.dfsek.terra.addons.noise.config.templates.normalizer.CubicSplineNormalizerTemplate; +import com.dfsek.terra.addons.noise.config.templates.normalizer.ExpressionNormalizerTemplate; +import com.dfsek.terra.addons.noise.config.templates.normalizer.LinearNormalizerTemplate; +import com.dfsek.terra.addons.noise.config.templates.normalizer.NormalNormalizerTemplate; +import com.dfsek.terra.addons.noise.config.templates.normalizer.PosterizationNormalizerTemplate; +import com.dfsek.terra.addons.noise.config.templates.normalizer.ProbabilityNormalizerTemplate; +import com.dfsek.terra.addons.noise.config.templates.normalizer.ScaleNormalizerTemplate; import com.dfsek.terra.addons.noise.math.CubicSpline; -import com.dfsek.terra.addons.noise.samplers.arithmetic.*; +import com.dfsek.terra.addons.noise.samplers.arithmetic.AdditionSampler; +import com.dfsek.terra.addons.noise.samplers.arithmetic.DivisionSampler; +import com.dfsek.terra.addons.noise.samplers.arithmetic.MaxSampler; +import com.dfsek.terra.addons.noise.samplers.arithmetic.MinSampler; +import com.dfsek.terra.addons.noise.samplers.arithmetic.MultiplicationSampler; +import com.dfsek.terra.addons.noise.samplers.arithmetic.SubtractionSampler; import com.dfsek.terra.addons.noise.samplers.noise.CellularSampler; import com.dfsek.terra.addons.noise.samplers.noise.DistanceSampler; import com.dfsek.terra.addons.noise.samplers.noise.random.GaussianNoiseSampler; @@ -41,10 +70,6 @@ import com.dfsek.terra.api.registry.CheckedRegistry; import com.dfsek.terra.api.util.reflection.TypeKey; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.function.Supplier; - public class NoiseAddon implements AddonInitializer { public static final TypeKey>> NOISE_SAMPLER_TOKEN = new TypeKey<>() { @@ -97,7 +122,7 @@ public void initialize() { noiseRegistry.register(addon.key("SIMPLEX"), () -> new SimpleNoiseTemplate(SimplexSampler::new)); noiseRegistry.register(addon.key("GABOR"), GaborNoiseTemplate::new); noiseRegistry.register(addon.key("PSEUDOEROSION"), PseudoErosionTemplate::new); - + noiseRegistry.register(addon.key("VALUE"), () -> new SimpleNoiseTemplate(ValueSampler::new)); noiseRegistry.register(addon.key("VALUE_CUBIC"), () -> new SimpleNoiseTemplate(ValueCubicSampler::new)); diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseConfigPackTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseConfigPackTemplate.java index c41af1763..d6ac6c00c 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseConfigPackTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/NoiseConfigPackTemplate.java @@ -11,14 +11,14 @@ import com.dfsek.tectonic.api.config.template.annotations.Default; import com.dfsek.tectonic.api.config.template.annotations.Value; -import java.util.LinkedHashMap; -import java.util.Map; - import com.dfsek.terra.addons.noise.config.DimensionApplicableNoiseSampler; import com.dfsek.terra.addons.noise.config.templates.FunctionTemplate; import com.dfsek.terra.api.config.meta.Meta; import com.dfsek.terra.api.properties.Properties; +import java.util.LinkedHashMap; +import java.util.Map; + @SuppressWarnings("FieldMayBeFinal") public class NoiseConfigPackTemplate implements ConfigTemplate, Properties { diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java index d93054ac9..9e66b23ea 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/DerivativeNoiseSamplerTemplate.java @@ -14,7 +14,8 @@ public class DerivativeNoiseSamplerTemplate extends SamplerTemplate { diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java index f815cd40c..03f2252e1 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java @@ -10,61 +10,48 @@ public class PseudoErosionTemplate extends NoiseTemplate { + @Value("frequency") + @Default + protected @Meta double frequency = 1d; @Value("octaves") @Default private int octaves = 4; - @Value("lacunarity") @Default private double lacunarity = 2.0; - @Value("gain") @Default private double gain = 0.5; - @Value("slope-strength") @Default private double slopeStrength = 1.0; - @Value("branch-strength") @Default private double branchStrength = 1.0; - @Value("strength") @Default private double strength = 0.04; - @Value("erosion-frequency") @Default private double erosionFrequency = 0.02; - @Value("sampler") private DerivativeNoiseSampler heightSampler; - @Value("slope-mask.enable") @Default private boolean slopeMask = true; - @Value("slope-mask.none") @Default private double slopeMaskNone = -0.5; - @Value("slope-mask.full") @Default private double slopeMaskFull = 1; - @Value("jitter") @Default private double jitterModifier = 1; - @Value("average-impulses") @Default private boolean averageErosionImpulses = true; - @Value("frequency") - @Default - protected @Meta double frequency = 1d; - @Override public PseudoErosionSampler get() { PseudoErosionSampler pseudoErosion = new PseudoErosionSampler(octaves, gain, lacunarity, diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/DerivativeNoiseFunction.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/DerivativeNoiseFunction.java index c5caa0d3a..0d654eb64 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/DerivativeNoiseFunction.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/DerivativeNoiseFunction.java @@ -2,6 +2,7 @@ import com.dfsek.terra.api.noise.DerivativeNoiseSampler; + public abstract class DerivativeNoiseFunction extends NoiseFunction implements DerivativeNoiseSampler { @Override public boolean isDifferentiable() { diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java index 0b96ea517..c761d2e80 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java @@ -9,12 +9,12 @@ public class PseudoErosionSampler extends NoiseFunction { public static final float TAU = (float) (2.0 * Math.PI); private static final float HASH_X = 0.3183099f; private static final float HASH_Y = 0.3678794f; - private final int octaves; public final double gain; public final double lacunarity; public final double slopeStrength; public final double branchStrength; public final double erosionStrength; + private final int octaves; private final double erosionFrequency; private final DerivativeNoiseSampler sampler; private final boolean slopeMask; @@ -25,7 +25,8 @@ public class PseudoErosionSampler extends NoiseFunction { private final double maxCellDistSqRecip; private final boolean averageErosionImpulses; - public PseudoErosionSampler(int octaves, double gain, double lacunarity, double slopeStrength, double branchStrength, double erosionStrength, double erosionFrequency, DerivativeNoiseSampler sampler, + public PseudoErosionSampler(int octaves, double gain, double lacunarity, double slopeStrength, double branchStrength, + double erosionStrength, double erosionFrequency, DerivativeNoiseSampler sampler, boolean slopeMask, double slopeMaskFull, double slopeMaskNone, double jitterModifier, boolean averageErosionImpulses) { this.octaves = octaves; @@ -59,7 +60,22 @@ public static float hashY(float seed, float n) { } public static float fract(float x) { - return (x - (float)Math.floor(x)); + return (x - (float) Math.floor(x)); + } + + public static float smoothstep(float edge0, float edge1, float x) { + // Scale, bias and saturate x to 0..1 range + x = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f); + // Evaluate polynomial + return x * x * (3 - 2 * x); + } + + public static float clamp(float x, float minVal, float maxVal) { + return Math.max(minVal, Math.min(maxVal, x)); + } + + public static float dot(float x1, float y1, float x2, float y2) { + return x1 * x2 + y1 * y2; } public float[] erosion(int seed, float x, float y, float dirX, float dirY) { @@ -70,16 +86,17 @@ public float[] erosion(int seed, float x, float y, float dirX, float dirY) { float dirOutY = 0.0f; float cumAmp = 0.0f; - for (int cellX = gridX - 1; cellX <= gridX + 1; cellX++) { - for (int cellY = gridY - 1; cellY <= gridY + 1; cellY++) { + for(int cellX = gridX - 1; cellX <= gridX + 1; cellX++) { + for(int cellY = gridY - 1; cellY <= gridY + 1; cellY++) { float cellHash = hash(seed, cellX, cellY); float cellOffsetX = (float) (hashX(seed, cellHash) * jitter); float cellOffsetY = (float) (hashY(seed, cellHash) * jitter); float cellOriginDeltaX = (x - cellX) + cellOffsetX; float cellOriginDeltaY = (y - cellY) + cellOffsetY; float cellOriginDistSq = cellOriginDeltaX * cellOriginDeltaX + cellOriginDeltaY * cellOriginDeltaY; - if (cellOriginDistSq > maxCellDistSq) continue; // Skip calculating cells too far away - float ampTmp = (float) ((cellOriginDistSq * maxCellDistSqRecip) - 1); float amp = ampTmp * ampTmp; // Decrease cell amplitude further away + if(cellOriginDistSq > maxCellDistSq) continue; // Skip calculating cells too far away + float ampTmp = (float) ((cellOriginDistSq * maxCellDistSqRecip) - 1); + float amp = ampTmp * ampTmp; // Decrease cell amplitude further away cumAmp += amp; float directionalStrength = dot(cellOriginDeltaX, cellOriginDeltaY, dirX, dirY) * TAU; noise += (float) (MathUtil.cos(directionalStrength) * amp); @@ -88,23 +105,12 @@ public float[] erosion(int seed, float x, float y, float dirX, float dirY) { dirOutY -= sinAngle * (cellOriginDeltaY + dirY); } } - if (averageErosionImpulses && cumAmp != 0) { + if(averageErosionImpulses && cumAmp != 0) { noise /= cumAmp; dirOutX /= cumAmp; dirOutY /= cumAmp; } - return new float[] {noise, dirOutX, dirOutY}; - } - - public static float smoothstep(float edge0, float edge1, float x) { - // Scale, bias and saturate x to 0..1 range - x = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f); - // Evaluate polynomial - return x * x * (3 - 2 * x); - } - - public static float clamp(float x, float minVal, float maxVal) { - return Math.max(minVal, Math.min(maxVal, x)); + return new float[]{ noise, dirOutX, dirOutY }; } public float heightMap(long seed, float x, float y) { @@ -125,7 +131,7 @@ public float heightMap(long seed, float x, float y) { float freq = 1.0f; // Stack erosion octaves - for (int i = 0; i < octaves; i++) { + for(int i = 0; i < octaves; i++) { float[] erosionResult = erosion((int) seed, x * freq * (float) erosionFrequency, y * freq * (float) erosionFrequency, @@ -139,7 +145,6 @@ public float heightMap(long seed, float x, float y) { freq *= lacunarity; } - // TODO - Test different output ranges, see how they affect visuals // Normalize erosion noise erosion /= cumAmp; // [-1, 1] -> [0, 1] @@ -147,7 +152,7 @@ public float heightMap(long seed, float x, float y) { // Without masking, erosion noise in areas with small gradients tend to produce mounds, // this reduces erosion amplitude towards smaller gradients to avoid this - if (slopeMask) { + if(slopeMask) { float dirMagSq = dot(baseDirX, baseDirY, baseDirX, baseDirY); float flatness = smoothstep((float) slopeMaskNoneSq, (float) slopeMaskFullSq, dirMagSq); erosion *= flatness; @@ -156,10 +161,6 @@ public float heightMap(long seed, float x, float y) { return (float) (height + erosion * erosionStrength); } - public static float dot(float x1, float y1, float x2, float y2) { - return x1 * x2 + y1 * y2; - } - @Override public double getNoiseRaw(long seed, double x, double y) { return heightMap(seed, (float) x, (float) y); diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java index ef81ff139..86adcee3b 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2SSampler.java @@ -276,6 +276,7 @@ public double getNoiseRaw(long sl, double x, double y, double z) { return value * 9.046026385208288; } + @Override public boolean isDifferentiable() { return true; @@ -283,173 +284,174 @@ public boolean isDifferentiable() { @Override public double[] getNoiseDerivativeRaw(long sl, double x, double y) { - int seed = (int) sl; - // 2D OpenSimplex2S case is a modified 2D simplex noise. - - final double SQRT3 = 1.7320508075688772935274463415059; - final double G2 = (3 - SQRT3) / 6; - - final double F2 = 0.5f * (SQRT3 - 1); - double s = (x + y) * F2; - x += s; - y += s; - - - int i = (int) Math.floor(x); - int j = (int) Math.floor(y); - double xi = x - i; - double yi = y - j; - - i *= PRIME_X; - j *= PRIME_Y; - int i1 = i + PRIME_X; - int j1 = j + PRIME_Y; - - double t = (xi + yi) * G2; - double x0 = xi - t; - double y0 = yi - t; - - double[] out = { 0.0f, 0.0f, 0.0f }; - - double a0 = (2.0 / 3.0) - x0 * x0 - y0 * y0; - double aa0 = a0 * a0, aaa0 = aa0 * a0, aaaa0 = aa0 * aa0; - int gi0 = gradCoordIndex(seed, i, j); - double gx0 = GRADIENTS_2_D[gi0], gy0 = GRADIENTS_2_D[gi0 | 1]; - double rampValue0 = gx0 * x0 + gy0 * y0; - out[0] = aaaa0 * rampValue0; - out[1] = gx0 * aaaa0 - 8 * rampValue0 * aaa0 * x0; - out[2] = gy0 * aaaa0 - 8 * rampValue0 * aaa0 * y0; - - - - double a1 = 2 * (1 - 2 * G2) * (1 / G2 - 2) * t + ((-2 * (1 - 2 * G2) * (1 - 2 * G2)) + a0); - double x1 = x0 - (1 - 2 * G2); - double y1 = y0 - (1 - 2 * G2); - double aa1 = a1 * a1, aaa1 = aa1 * a1, aaaa1 = aa1 * aa1; - int gi1 = gradCoordIndex(seed, i1, j1); - double gx1 = GRADIENTS_2_D[gi1], gy1 = GRADIENTS_2_D[gi1 | 1]; - double rampValue1 = gx1 * x1 + gy1 * y1; - out[0] += aaaa1 * rampValue1; - out[1] += gx1 * aaaa1 - 8 * rampValue1 * aaa1 * x1; - out[2] += gy1 * aaaa1 - 8 * rampValue1 * aaa1 * y1; - - // Nested conditionals were faster than compact bit logic/arithmetic. - double xmyi = xi - yi; - if(t > G2) { - if(xi + xmyi > 1) { - double x2 = x0 + (3 * G2 - 2); - double y2 = y0 + (3 * G2 - 1); - double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; - if(a2 > 0) { - double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; - int gi2 = gradCoordIndex(seed, i + (PRIME_X << 1), j + PRIME_Y); - double gx2 = GRADIENTS_2_D[gi2 | 0], gy2 = GRADIENTS_2_D[gi2 | 1]; - double rampValue2 = gx2 * x2 + gy2 * y2; - out[0] += aaaa2 * rampValue2; - out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; - out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; - } - } else { - double x2 = x0 + G2; - double y2 = y0 + (G2 - 1); - double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; - if(a2 > 0) { - double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; - int gi2 = gradCoordIndex(seed, i, j + PRIME_Y); - double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; - double rampValue2 = gx2 * x2 + gy2 * y2; - out[0] += aaaa2 * rampValue2; - out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; - out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; - } - } - - if(yi - xmyi > 1) { - double x3 = x0 + (3 * G2 - 1); - double y3 = y0 + (3 * G2 - 2); - double a3 = (2.0 / 3.0) - x3 * x3 - y3 * y3; - if(a3 > 0) { - double aa3 = a3 * a3, aaa3 = aa3 * a3, aaaa3 = aa3 * aa3; - int gi3 = gradCoordIndex(seed, i + PRIME_X, j + (PRIME_Y << 1)); - double gx3 = GRADIENTS_2_D[gi3], gy3 = GRADIENTS_2_D[gi3 | 1]; - double rampValue3 = gx3 * x3 + gy3 * y3; - out[0] += aaaa3 * rampValue3; - out[1] += gx3 * aaaa3 - 8 * rampValue3 * aaa3 * x3; - out[2] += gy3 * aaaa3 - 8 * rampValue3 * aaa3 * y3; - } - } else { - double x3 = x0 + (G2 - 1); - double y3 = y0 + G2; - double a3 = (2.0 / 3.0) - x3 * x3 - y3 * y3; - if(a3 > 0) { - double aa3 = a3 * a3, aaa3 = aa3 * a3, aaaa3 = aa3 * aa3; - int gi3 = gradCoordIndex(seed, i + PRIME_X, j); - double gx3 = GRADIENTS_2_D[gi3], gy3 = GRADIENTS_2_D[gi3 | 1]; - double rampValue3 = gx3 * x3 + gy3 * y3; - out[0] += aaaa3 * rampValue3; - out[1] += gx3 * aaaa3 - 8 * rampValue3 * aaa3 * x3; - out[2] += gy3 * aaaa3 - 8 * rampValue3 * aaa3 * y3; - } - } - } else { - if(xi + xmyi < 0) { - double x2 = x0 + (1 - G2); - double y2 = y0 - G2; - double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; - if(a2 > 0) { - double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; - int gi2 = gradCoordIndex(seed, i - PRIME_X, j); - double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; - double rampValue2 = gx2 * x2 + gy2 * y2; - out[0] += aaaa2 * rampValue2; - out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; - out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; } - } else { - double x2 = x0 + (G2 - 1); - double y2 = y0 + G2; - double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; - if(a2 > 0) { - double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; - int gi2 = gradCoordIndex(seed, i + PRIME_X, j); - double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; - double rampValue2 = gx2 * x2 + gy2 * y2; - out[0] += aaaa2 * rampValue2; - out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; - out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; - } - } - - if(yi < xmyi) { - double x2 = x0 - G2; - double y2 = y0 - (G2 - 1); - double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; - if(a2 > 0) { - double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; - int gi2 = gradCoordIndex(seed, i, j - PRIME_Y); - double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; - double rampValue2 = gx2 * x2 + gy2 * y2; - out[0] += aaaa2 * rampValue2; - out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; - out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; } - } else { - double x2 = x0 + G2; - double y2 = y0 + (G2 - 1); - double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; - if(a2 > 0) { - double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; - int gi2 = gradCoordIndex(seed, i, j + PRIME_Y); - double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; - double rampValue2 = gx2 * x2 + gy2 * y2; - out[0] += aaaa2 * rampValue2; - out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; - out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; - } - } + int seed = (int) sl; + // 2D OpenSimplex2S case is a modified 2D simplex noise. + + final double SQRT3 = 1.7320508075688772935274463415059; + final double G2 = (3 - SQRT3) / 6; + + final double F2 = 0.5f * (SQRT3 - 1); + double s = (x + y) * F2; + x += s; + y += s; + + + int i = (int) Math.floor(x); + int j = (int) Math.floor(y); + double xi = x - i; + double yi = y - j; + + i *= PRIME_X; + j *= PRIME_Y; + int i1 = i + PRIME_X; + int j1 = j + PRIME_Y; + + double t = (xi + yi) * G2; + double x0 = xi - t; + double y0 = yi - t; + + double[] out = { 0.0f, 0.0f, 0.0f }; + + double a0 = (2.0 / 3.0) - x0 * x0 - y0 * y0; + double aa0 = a0 * a0, aaa0 = aa0 * a0, aaaa0 = aa0 * aa0; + int gi0 = gradCoordIndex(seed, i, j); + double gx0 = GRADIENTS_2_D[gi0], gy0 = GRADIENTS_2_D[gi0 | 1]; + double rampValue0 = gx0 * x0 + gy0 * y0; + out[0] = aaaa0 * rampValue0; + out[1] = gx0 * aaaa0 - 8 * rampValue0 * aaa0 * x0; + out[2] = gy0 * aaaa0 - 8 * rampValue0 * aaa0 * y0; + + + double a1 = 2 * (1 - 2 * G2) * (1 / G2 - 2) * t + ((-2 * (1 - 2 * G2) * (1 - 2 * G2)) + a0); + double x1 = x0 - (1 - 2 * G2); + double y1 = y0 - (1 - 2 * G2); + double aa1 = a1 * a1, aaa1 = aa1 * a1, aaaa1 = aa1 * aa1; + int gi1 = gradCoordIndex(seed, i1, j1); + double gx1 = GRADIENTS_2_D[gi1], gy1 = GRADIENTS_2_D[gi1 | 1]; + double rampValue1 = gx1 * x1 + gy1 * y1; + out[0] += aaaa1 * rampValue1; + out[1] += gx1 * aaaa1 - 8 * rampValue1 * aaa1 * x1; + out[2] += gy1 * aaaa1 - 8 * rampValue1 * aaa1 * y1; + + // Nested conditionals were faster than compact bit logic/arithmetic. + double xmyi = xi - yi; + if(t > G2) { + if(xi + xmyi > 1) { + double x2 = x0 + (3 * G2 - 2); + double y2 = y0 + (3 * G2 - 1); + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i + (PRIME_X << 1), j + PRIME_Y); + double gx2 = GRADIENTS_2_D[gi2 | 0], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; } - out[0] *= 18.24196194486065; - out[1] *= 18.24196194486065; - out[2] *= 18.24196194486065; - return out; + } else { + double x2 = x0 + G2; + double y2 = y0 + (G2 - 1); + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i, j + PRIME_Y); + double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; + } + } + + if(yi - xmyi > 1) { + double x3 = x0 + (3 * G2 - 1); + double y3 = y0 + (3 * G2 - 2); + double a3 = (2.0 / 3.0) - x3 * x3 - y3 * y3; + if(a3 > 0) { + double aa3 = a3 * a3, aaa3 = aa3 * a3, aaaa3 = aa3 * aa3; + int gi3 = gradCoordIndex(seed, i + PRIME_X, j + (PRIME_Y << 1)); + double gx3 = GRADIENTS_2_D[gi3], gy3 = GRADIENTS_2_D[gi3 | 1]; + double rampValue3 = gx3 * x3 + gy3 * y3; + out[0] += aaaa3 * rampValue3; + out[1] += gx3 * aaaa3 - 8 * rampValue3 * aaa3 * x3; + out[2] += gy3 * aaaa3 - 8 * rampValue3 * aaa3 * y3; + } + } else { + double x3 = x0 + (G2 - 1); + double y3 = y0 + G2; + double a3 = (2.0 / 3.0) - x3 * x3 - y3 * y3; + if(a3 > 0) { + double aa3 = a3 * a3, aaa3 = aa3 * a3, aaaa3 = aa3 * aa3; + int gi3 = gradCoordIndex(seed, i + PRIME_X, j); + double gx3 = GRADIENTS_2_D[gi3], gy3 = GRADIENTS_2_D[gi3 | 1]; + double rampValue3 = gx3 * x3 + gy3 * y3; + out[0] += aaaa3 * rampValue3; + out[1] += gx3 * aaaa3 - 8 * rampValue3 * aaa3 * x3; + out[2] += gy3 * aaaa3 - 8 * rampValue3 * aaa3 * y3; + } + } + } else { + if(xi + xmyi < 0) { + double x2 = x0 + (1 - G2); + double y2 = y0 - G2; + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i - PRIME_X, j); + double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; + } + } else { + double x2 = x0 + (G2 - 1); + double y2 = y0 + G2; + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i + PRIME_X, j); + double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; + } + } + + if(yi < xmyi) { + double x2 = x0 - G2; + double y2 = y0 - (G2 - 1); + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i, j - PRIME_Y); + double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; + } + } else { + double x2 = x0 + G2; + double y2 = y0 + (G2 - 1); + double a2 = (2.0 / 3.0) - x2 * x2 - y2 * y2; + if(a2 > 0) { + double aa2 = a2 * a2, aaa2 = aa2 * a2, aaaa2 = aa2 * aa2; + int gi2 = gradCoordIndex(seed, i, j + PRIME_Y); + double gx2 = GRADIENTS_2_D[gi2], gy2 = GRADIENTS_2_D[gi2 | 1]; + double rampValue2 = gx2 * x2 + gy2 * y2; + out[0] += aaaa2 * rampValue2; + out[1] += gx2 * aaaa2 - 8 * rampValue2 * aaa2 * x2; + out[2] += gy2 * aaaa2 - 8 * rampValue2 * aaa2 * y2; + } + } + } + out[0] *= 18.24196194486065; + out[1] *= 18.24196194486065; + out[2] *= 18.24196194486065; + return out; } @Override diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java index 443146a9b..862a665c8 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/simplex/OpenSimplex2Sampler.java @@ -206,7 +206,8 @@ public double[] getNoiseDerivativeRaw(long sl, double x, double y) { double rampValue = gx * x2 + gy * y2; out[0] += cccc * rampValue; out[1] += gx * cccc - 8 * rampValue * ccc * x2; - out[2] += gy * cccc - 8 * rampValue * ccc * y2; } + out[2] += gy * cccc - 8 * rampValue * ccc * y2; + } if(y0 > x0) { double x1 = x0 + G2; @@ -219,7 +220,8 @@ public double[] getNoiseDerivativeRaw(long sl, double x, double y) { double rampValue = gx * x1 + gy * y1; out[0] += bbbb * rampValue; out[1] += gx * bbbb - 8 * rampValue * bbb * x1; - out[2] += gy * bbbb - 8 * rampValue * bbb * y1; } + out[2] += gy * bbbb - 8 * rampValue * bbb * y1; + } } else { double x1 = x0 + (G2 - 1); double y1 = y0 + G2; @@ -231,7 +233,8 @@ public double[] getNoiseDerivativeRaw(long sl, double x, double y) { double rampValue = gx * x1 + gy * y1; out[0] += bbbb * rampValue; out[1] += gx * bbbb - 8 * rampValue * bbb * x1; - out[2] += gy * bbbb - 8 * rampValue * bbb * y1; } + out[2] += gy * bbbb - 8 * rampValue * bbb * y1; + } } out[0] *= 99.83685446303647f; @@ -242,114 +245,116 @@ public double[] getNoiseDerivativeRaw(long sl, double x, double y) { @Override public double[] getNoiseDerivativeRaw(long sl, double x, double y, double z) { - int seed = (int) sl; - // 3D OpenSimplex2Sampler case uses two offset rotated cube grids. - final double R3 = (2.0 / 3.0); - double r = (x + y + z) * R3; // Rotation, not skew - x = r - x; - y = r - y; - z = r - z; - - - int i = (int) Math.round(x); - int j = (int) Math.round(y); - int k = (int) Math.round(z); - double x0 = x - i; - double y0 = y - j; - double z0 = z - k; - - int xNSign = (int) (-1.0 - x0) | 1; - int yNSign = (int) (-1.0 - y0) | 1; - int zNSign = (int) (-1.0 - z0) | 1; - - double ax0 = xNSign * -x0; - double ay0 = yNSign * -y0; - double az0 = zNSign * -z0; - - i *= PRIME_X; - j *= PRIME_Y; - k *= PRIME_Z; - - double[] out = { 0.0f, 0.0f, 0.0f, 0.0f }; - double a = (0.6f - x0 * x0) - (y0 * y0 + z0 * z0); - - for(int l = 0; ; l++) { - if(a > 0) { - double aa = a * a, aaa = aa * a, aaaa = aa * aa; - int gi = gradCoordIndex(seed, i, j, k); + int seed = (int) sl; + // 3D OpenSimplex2Sampler case uses two offset rotated cube grids. + final double R3 = (2.0 / 3.0); + double r = (x + y + z) * R3; // Rotation, not skew + x = r - x; + y = r - y; + z = r - z; + + + int i = (int) Math.round(x); + int j = (int) Math.round(y); + int k = (int) Math.round(z); + double x0 = x - i; + double y0 = y - j; + double z0 = z - k; + + int xNSign = (int) (-1.0 - x0) | 1; + int yNSign = (int) (-1.0 - y0) | 1; + int zNSign = (int) (-1.0 - z0) | 1; + + double ax0 = xNSign * -x0; + double ay0 = yNSign * -y0; + double az0 = zNSign * -z0; + + i *= PRIME_X; + j *= PRIME_Y; + k *= PRIME_Z; + + double[] out = { 0.0f, 0.0f, 0.0f, 0.0f }; + double a = (0.6f - x0 * x0) - (y0 * y0 + z0 * z0); + + for(int l = 0; ; l++) { + if(a > 0) { + double aa = a * a, aaa = aa * a, aaaa = aa * aa; + int gi = gradCoordIndex(seed, i, j, k); + double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; + double rampValue = gx * x0 + gy * y0 + gz * z0; + out[0] += aaaa * rampValue; + out[1] += gx * aaaa - 8 * rampValue * aaa * x0; + out[1] += gy * aaaa - 8 * rampValue * aaa * y0; + out[2] += gz * aaaa - 8 * rampValue * aaa * z0; + } + + if(ax0 >= ay0 && ax0 >= az0) { + double b = a + ax0 + ax0; + if(b > 1) { + b -= 1; + double bb = b * b, bbb = bb * b, bbbb = bb * bb; + int gi = gradCoordIndex(seed, i - xNSign * PRIME_X, j, k); double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; - double rampValue = gx * x0 + gy * y0 + gz * z0; - out[0] += aaaa * rampValue; - out[1] += gx * aaaa - 8 * rampValue * aaa * x0; - out[1] += gy * aaaa - 8 * rampValue * aaa * y0; - out[2] += gz * aaaa - 8 * rampValue * aaa * z0; + double rampValue = gx * (x0 + xNSign) + gy * y0 + gz * z0; + out[0] += bbbb * rampValue; + out[1] += gx * bbbb - 8 * rampValue * bbb * (x0 + xNSign); + out[1] += gy * bbbb - 8 * rampValue * bbb * y0; + out[2] += gz * bbbb - 8 * rampValue * bbb * z0; } - - if(ax0 >= ay0 && ax0 >= az0) { - double b = a + ax0 + ax0; - if(b > 1) { - b -= 1; - double bb = b * b, bbb = bb * b, bbbb = bb * bb; - int gi = gradCoordIndex(seed, i - xNSign * PRIME_X, j, k); - double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; - double rampValue = gx * (x0 + xNSign) + gy * y0 + gz * z0; - out[0] += bbbb * rampValue; - out[1] += gx * bbbb - 8 * rampValue * bbb * (x0 + xNSign); - out[1] += gy * bbbb - 8 * rampValue * bbb * y0; - out[2] += gz * bbbb - 8 * rampValue * bbb * z0; - } - } else if(ay0 > ax0 && ay0 >= az0) { - double b = a + ay0 + ay0; - if(b > 1) { - b -= 1; - double bb = b * b, bbb = bb * b, bbbb = bb * bb; - int gi = gradCoordIndex(seed, i, j - yNSign * PRIME_Y, k); - double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; - double rampValue = gx * x0 + gy * (y0 + yNSign) + gz * z0; - out[0] += bbbb * rampValue; - out[1] += gx * bbbb - 8 * rampValue * bbb * x0; - out[1] += gy * bbbb - 8 * rampValue * bbb * (y0 + yNSign); - out[2] += gz * bbbb - 8 * rampValue * bbb * z0; } - } else { - double b = a + az0 + az0; - if(b > 1) { - b -= 1; - double bb = b * b, bbb = bb * b, bbbb = bb * bb; - int gi = gradCoordIndex(seed, i, j, k - zNSign * PRIME_Z); - double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; - double rampValue = gx * x0 + gy * y0 + gz * (z0 + zNSign); - out[0] += bbbb * rampValue; - out[1] += gx * bbbb - 8 * rampValue * bbb * x0; - out[1] += gy * bbbb - 8 * rampValue * bbb * y0; - out[2] += gz * bbbb - 8 * rampValue * bbb * (z0 + zNSign); } + } else if(ay0 > ax0 && ay0 >= az0) { + double b = a + ay0 + ay0; + if(b > 1) { + b -= 1; + double bb = b * b, bbb = bb * b, bbbb = bb * bb; + int gi = gradCoordIndex(seed, i, j - yNSign * PRIME_Y, k); + double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; + double rampValue = gx * x0 + gy * (y0 + yNSign) + gz * z0; + out[0] += bbbb * rampValue; + out[1] += gx * bbbb - 8 * rampValue * bbb * x0; + out[1] += gy * bbbb - 8 * rampValue * bbb * (y0 + yNSign); + out[2] += gz * bbbb - 8 * rampValue * bbb * z0; } + } else { + double b = a + az0 + az0; + if(b > 1) { + b -= 1; + double bb = b * b, bbb = bb * b, bbbb = bb * bb; + int gi = gradCoordIndex(seed, i, j, k - zNSign * PRIME_Z); + double gx = GRADIENTS_3D[gi], gy = GRADIENTS_3D[gi | 1], gz = GRADIENTS_3D[gi | 2]; + double rampValue = gx * x0 + gy * y0 + gz * (z0 + zNSign); + out[0] += bbbb * rampValue; + out[1] += gx * bbbb - 8 * rampValue * bbb * x0; + out[1] += gy * bbbb - 8 * rampValue * bbb * y0; + out[2] += gz * bbbb - 8 * rampValue * bbb * (z0 + zNSign); + } + } - if(l == 1) break; + if(l == 1) break; - ax0 = 0.5 - ax0; - ay0 = 0.5 - ay0; - az0 = 0.5 - az0; + ax0 = 0.5 - ax0; + ay0 = 0.5 - ay0; + az0 = 0.5 - az0; - x0 = xNSign * ax0; - y0 = yNSign * ay0; - z0 = zNSign * az0; + x0 = xNSign * ax0; + y0 = yNSign * ay0; + z0 = zNSign * az0; - a += (0.75 - ax0) - (ay0 + az0); + a += (0.75 - ax0) - (ay0 + az0); - i += (xNSign >> 1) & PRIME_X; - j += (yNSign >> 1) & PRIME_Y; - k += (zNSign >> 1) & PRIME_Z; + i += (xNSign >> 1) & PRIME_X; + j += (yNSign >> 1) & PRIME_Y; + k += (zNSign >> 1) & PRIME_Z; - xNSign = -xNSign; - yNSign = -yNSign; - zNSign = -zNSign; + xNSign = -xNSign; + yNSign = -yNSign; + zNSign = -zNSign; - seed = ~seed; - } - out[0] *= 32.69428253173828125; - out[1] *= 32.69428253173828125; - out[2] *= 32.69428253173828125; - out[3] *= 32.69428253173828125; - return out; + seed = ~seed; } + out[0] *= 32.69428253173828125; + out[1] *= 32.69428253173828125; + out[2] *= 32.69428253173828125; + out[3] *= 32.69428253173828125; + return out; + } } 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 a5fd3f3bf..f9c3f65a7 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 @@ -8,7 +8,6 @@ package com.dfsek.terra.addons.noise.samplers.noise.simplex; import com.dfsek.terra.addons.noise.samplers.noise.DerivativeNoiseFunction; -import com.dfsek.terra.addons.noise.samplers.noise.NoiseFunction; /** @@ -117,12 +116,12 @@ protected static double gradCoord(int seed, int xPrimed, int yPrimed, int zPrime @Override public double[] getNoiseDerivativeRaw(long seed, double x, double y) { - return new double[]{0, 0, 0}; + return new double[]{ 0, 0, 0 }; } @Override public double[] getNoiseDerivativeRaw(long seed, double x, double y, double z) { - return new double[]{0, 0, 0, 0}; + return new double[]{ 0, 0, 0, 0 }; } @Override diff --git a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationAddon.java b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationAddon.java index 41009ed0b..f1ca7d945 100644 --- a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationAddon.java +++ b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationAddon.java @@ -11,13 +11,6 @@ import com.dfsek.tectonic.api.config.template.dynamic.DynamicValue; import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; - import com.dfsek.terra.addons.generation.feature.config.BiomeFeatures; import com.dfsek.terra.addons.generation.feature.config.FeatureStageTemplate; import com.dfsek.terra.addons.manifest.api.AddonInitializer; @@ -35,6 +28,9 @@ import com.dfsek.terra.api.world.biome.Biome; import com.dfsek.terra.api.world.chunk.generation.stage.GenerationStage; +import java.util.*; +import java.util.function.Supplier; + public class FeatureGenerationAddon implements AddonInitializer { public static final TypeKey>> STAGE_TYPE_KEY = new TypeKey<>() { diff --git a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java index 11a1e3ca7..132889d23 100644 --- a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java +++ b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java @@ -7,9 +7,6 @@ package com.dfsek.terra.addons.generation.feature; -import java.util.Collections; -import java.util.Random; - import com.dfsek.terra.addons.generation.feature.config.BiomeFeatures; import com.dfsek.terra.api.Platform; import com.dfsek.terra.api.noise.NoiseSampler; @@ -22,6 +19,9 @@ import com.dfsek.terra.api.world.chunk.generation.stage.GenerationStage; import com.dfsek.terra.api.world.chunk.generation.util.Column; +import java.util.Collections; +import java.util.Random; + public class FeatureGenerationStage implements GenerationStage, StringIdentifiable { private final Platform platform; diff --git a/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java b/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java index 30b2d5984..5b18dd063 100644 --- a/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java +++ b/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java @@ -1,7 +1,5 @@ package com.dfsek.terra.addons.structure.mutator; -import java.util.Random; - import com.dfsek.terra.api.registry.key.Keyed; import com.dfsek.terra.api.registry.key.RegistryKey; import com.dfsek.terra.api.structure.Structure; @@ -11,6 +9,8 @@ import com.dfsek.terra.api.world.util.ReadInterceptor; import com.dfsek.terra.api.world.util.WriteInterceptor; +import java.util.Random; + public class MutatedStructure implements Structure, Keyed { private final RegistryKey key; diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/parser/ParserUtil.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/parser/ParserUtil.java index b982b0979..4fc805a8f 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/parser/ParserUtil.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/parser/ParserUtil.java @@ -7,15 +7,15 @@ package com.dfsek.terra.addons.terrascript.parser; -import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException; -import com.dfsek.terra.addons.terrascript.parser.lang.Returnable; -import com.dfsek.terra.addons.terrascript.tokenizer.Token; - import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException; +import com.dfsek.terra.addons.terrascript.parser.lang.Returnable; +import com.dfsek.terra.addons.terrascript.tokenizer.Token; + public class ParserUtil { diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/builders/CheckBlockFunctionBuilder.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/builders/CheckBlockFunctionBuilder.java index 588b99f53..cfef3f572 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/builders/CheckBlockFunctionBuilder.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/builders/CheckBlockFunctionBuilder.java @@ -7,13 +7,13 @@ package com.dfsek.terra.addons.terrascript.script.builders; -import java.util.List; - import com.dfsek.terra.addons.terrascript.parser.lang.Returnable; import com.dfsek.terra.addons.terrascript.parser.lang.functions.FunctionBuilder; import com.dfsek.terra.addons.terrascript.script.functions.CheckBlockFunction; import com.dfsek.terra.addons.terrascript.tokenizer.Position; +import java.util.List; + public class CheckBlockFunctionBuilder implements FunctionBuilder { @SuppressWarnings("unchecked") diff --git a/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java b/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java index 0e178130b..f9e40f0ea 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java +++ b/common/api/src/main/java/com/dfsek/terra/api/noise/DerivativeNoiseSampler.java @@ -6,7 +6,7 @@ public interface DerivativeNoiseSampler extends NoiseSampler { static boolean isDifferentiable(NoiseSampler sampler) { - if (sampler instanceof DerivativeNoiseSampler dSampler) { + if(sampler instanceof DerivativeNoiseSampler dSampler) { return dSampler.isDifferentiable(); } return false; @@ -22,19 +22,23 @@ static boolean isDifferentiable(NoiseSampler sampler) { /** * Derivative return version of standard 2D noise evaluation + * * @param seed * @param x * @param y + * * @return 3 element array, in index order: noise value, partial x derivative, partial y derivative */ double[] noised(long seed, double x, double y); /** * Derivative return version of standard 3D noise evaluation + * * @param seed * @param x * @param y * @param z + * * @return 4 element array, in index order: noise value, partial x derivative, partial y derivative, partial z derivative */ double[] noised(long seed, double x, double y, double z); diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java index 0dbe5bb23..d12f31c47 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java @@ -29,7 +29,7 @@ public final class MathUtil { static { sinTable = new long[lookupTableSizeWithMargin]; - for (int i = 0; i < lookupTableSizeWithMargin; i++) { + for(int i = 0; i < lookupTableSizeWithMargin; i++) { double d = i * tauOverLookupSize; sinTable[i] = Double.doubleToRawLongBits(StrictMath.sin(d)); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java b/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java index d049cd43b..3aed2b9ac 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java +++ b/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java @@ -7,18 +7,18 @@ package com.dfsek.terra.api.world.biome.generation; -import org.jetbrains.annotations.Contract; - -import java.util.Optional; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; - import com.dfsek.terra.api.util.Column; import com.dfsek.terra.api.util.vector.Vector3; import com.dfsek.terra.api.util.vector.Vector3Int; import com.dfsek.terra.api.world.biome.Biome; import com.dfsek.terra.api.world.info.WorldProperties; +import org.jetbrains.annotations.Contract; + +import java.util.Optional; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + /** * Provides locations of biomes in a world. diff --git a/common/implementation/base/src/main/java/com/dfsek/terra/config/preprocessor/MetaNumberPreprocessor.java b/common/implementation/base/src/main/java/com/dfsek/terra/config/preprocessor/MetaNumberPreprocessor.java index 9197adeb1..c823d7ec4 100644 --- a/common/implementation/base/src/main/java/com/dfsek/terra/config/preprocessor/MetaNumberPreprocessor.java +++ b/common/implementation/base/src/main/java/com/dfsek/terra/config/preprocessor/MetaNumberPreprocessor.java @@ -24,14 +24,15 @@ import com.dfsek.tectonic.api.exception.LoadException; import com.dfsek.tectonic.api.loader.ConfigLoader; import com.dfsek.tectonic.api.preprocessor.Result; + +import com.dfsek.terra.api.config.meta.Meta; +import com.dfsek.terra.api.util.reflection.TypeKey; + import org.jetbrains.annotations.NotNull; import java.lang.reflect.AnnotatedType; import java.util.Map; -import com.dfsek.terra.api.config.meta.Meta; -import com.dfsek.terra.api.util.reflection.TypeKey; - public class MetaNumberPreprocessor extends MetaPreprocessor { public static final TypeKey META_STRING_KEY = new TypeKey<@Meta String>() { diff --git a/common/implementation/base/src/main/java/com/dfsek/terra/event/FunctionalEventHandlerImpl.java b/common/implementation/base/src/main/java/com/dfsek/terra/event/FunctionalEventHandlerImpl.java index a35bf9366..67f984646 100644 --- a/common/implementation/base/src/main/java/com/dfsek/terra/event/FunctionalEventHandlerImpl.java +++ b/common/implementation/base/src/main/java/com/dfsek/terra/event/FunctionalEventHandlerImpl.java @@ -17,6 +17,17 @@ package com.dfsek.terra.event; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import com.dfsek.terra.api.addon.BaseAddon; import com.dfsek.terra.api.event.events.Event; import com.dfsek.terra.api.event.events.FailThroughEvent; @@ -25,12 +36,6 @@ import com.dfsek.terra.api.event.functional.FunctionalEventHandler; import com.dfsek.terra.api.util.reflection.TypeKey; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Type; -import java.util.*; - public class FunctionalEventHandlerImpl implements FunctionalEventHandler { private static final Logger logger = LoggerFactory.getLogger(FunctionalEventHandlerImpl.class); diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/BukkitEntity.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/BukkitEntity.java index 98f44e2ec..6df268180 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/BukkitEntity.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/BukkitEntity.java @@ -17,14 +17,14 @@ package com.dfsek.terra.bukkit; +import io.papermc.lib.PaperLib; +import org.bukkit.Location; + import com.dfsek.terra.api.entity.Entity; import com.dfsek.terra.api.util.vector.Vector3; import com.dfsek.terra.api.world.ServerWorld; import com.dfsek.terra.bukkit.world.BukkitAdapter; -import io.papermc.lib.PaperLib; -import org.bukkit.Location; - public class BukkitEntity implements Entity { private final org.bukkit.entity.Entity entity; diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/world/BukkitWorldProperties.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/world/BukkitWorldProperties.java index f9763df90..7ece9ac7b 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/world/BukkitWorldProperties.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/world/BukkitWorldProperties.java @@ -1,9 +1,9 @@ package com.dfsek.terra.bukkit.world; -import org.bukkit.generator.WorldInfo; - import com.dfsek.terra.api.world.info.WorldProperties; +import org.bukkit.generator.WorldInfo; + public class BukkitWorldProperties implements WorldProperties { private final WorldInfo delegate; diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java index 0cbfa77b4..48dc88249 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java @@ -1,5 +1,8 @@ package com.dfsek.terra.lifecycle; +import com.dfsek.terra.api.command.CommandSender; +import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent; + import net.minecraft.server.command.ServerCommandSource; import org.incendo.cloud.SenderMapper; import org.incendo.cloud.execution.ExecutionCoordinator; @@ -7,9 +10,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.dfsek.terra.api.command.CommandSender; -import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent; - public final class LifecycleEntryPoint { private static final Logger logger = LoggerFactory.getLogger(LifecycleEntryPoint.class); diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/MinecraftServerMixin.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/MinecraftServerMixin.java index 63a8b8170..0f04c0963 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/MinecraftServerMixin.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/mixin/lifecycle/MinecraftServerMixin.java @@ -18,6 +18,7 @@ import static com.dfsek.terra.lifecycle.util.LifecycleUtil.initialized; + @Mixin(MinecraftServer.class) public class MinecraftServerMixin { @Inject(method = "(Ljava/lang/Thread;Lnet/minecraft/world/level/storage/LevelStorage$Session;" + diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/LifecycleUtil.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/LifecycleUtil.java index 28346a6eb..9ba81f864 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/LifecycleUtil.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/LifecycleUtil.java @@ -13,6 +13,7 @@ public final class LifecycleUtil { public static boolean initialized = false; + private LifecycleUtil() { } From 42166d5239ad9d6d6fe0906b54bd8837fd333b14 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 20:59:02 -0600 Subject: [PATCH 45/56] bump version number --- common/addons/config-noise-function/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/addons/config-noise-function/build.gradle.kts b/common/addons/config-noise-function/build.gradle.kts index af2284b48..83d927a01 100644 --- a/common/addons/config-noise-function/build.gradle.kts +++ b/common/addons/config-noise-function/build.gradle.kts @@ -1,4 +1,4 @@ -version = version("1.1.0") +version = version("1.2.0") dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) From d69b0dba90000408a1f7d5d548f3bbd5a68dbdf8 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 21:06:07 -0600 Subject: [PATCH 46/56] reformat 2 --- .../noise/PseudoErosionTemplate.java | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java index 03f2252e1..4e2823271 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java @@ -9,48 +9,61 @@ public class PseudoErosionTemplate extends NoiseTemplate { - @Value("frequency") @Default protected @Meta double frequency = 1d; + @Value("octaves") @Default - private int octaves = 4; + private final int octaves = 4; + @Value("lacunarity") @Default - private double lacunarity = 2.0; + private final double lacunarity = 2.0; + @Value("gain") @Default - private double gain = 0.5; + private final double gain = 0.5; + @Value("slope-strength") @Default - private double slopeStrength = 1.0; + private final double slopeStrength = 1.0; + + @Value("branch-strength") @Default - private double branchStrength = 1.0; + private final double branchStrength = 1.0; + @Value("strength") @Default - private double strength = 0.04; + private final double strength = 0.04; + @Value("erosion-frequency") @Default - private double erosionFrequency = 0.02; + private final double erosionFrequency = 0.02; + @Value("sampler") private DerivativeNoiseSampler heightSampler; + @Value("slope-mask.enable") @Default - private boolean slopeMask = true; + private final boolean slopeMask = true; + @Value("slope-mask.none") @Default - private double slopeMaskNone = -0.5; + private final double slopeMaskNone = -0.5; + @Value("slope-mask.full") @Default - private double slopeMaskFull = 1; + private final double slopeMaskFull = 1; + @Value("jitter") @Default - private double jitterModifier = 1; + private final double jitterModifier = 1; + @Value("average-impulses") @Default - private boolean averageErosionImpulses = true; + private final boolean averageErosionImpulses = true; @Override public PseudoErosionSampler get() { From 9c8298fe530d09b8ad2da12dfbe704804e00edd2 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 21:09:19 -0600 Subject: [PATCH 47/56] convert pseudoerosion to double --- .../samplers/noise/PseudoErosionSampler.java | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java index c761d2e80..ecb566ca7 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/samplers/noise/PseudoErosionSampler.java @@ -6,9 +6,9 @@ public class PseudoErosionSampler extends NoiseFunction { - public static final float TAU = (float) (2.0 * Math.PI); - private static final float HASH_X = 0.3183099f; - private static final float HASH_Y = 0.3678794f; + public static final double TAU = 2.0 * Math.PI; + private static final double HASH_X = 0.3183099f; + private static final double HASH_Y = 0.3678794f; public final double gain; public final double lacunarity; public final double slopeStrength; @@ -48,59 +48,59 @@ public PseudoErosionSampler(int octaves, double gain, double lacunarity, double this.maxCellDistSqRecip = 1 / maxCellDistSq; } - public static float hashX(float seed, float n) { + public static double hashX(double seed, double n) { // Swapped the components here - float nx = HASH_X * n * seed; + double nx = HASH_X * n * seed; return -1.0f + 2.0f * fract(nx); } - public static float hashY(float seed, float n) { - float ny = HASH_Y * n * seed; + public static double hashY(double seed, double n) { + double ny = HASH_Y * n * seed; return -1.0f + 2.0f * fract(ny); } - public static float fract(float x) { - return (x - (float) Math.floor(x)); + public static double fract(double x) { + return (x - Math.floor(x)); } - public static float smoothstep(float edge0, float edge1, float x) { + public static double smoothstep(double edge0, double edge1, double x) { // Scale, bias and saturate x to 0..1 range x = clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f); // Evaluate polynomial return x * x * (3 - 2 * x); } - public static float clamp(float x, float minVal, float maxVal) { + public static double clamp(double x, double minVal, double maxVal) { return Math.max(minVal, Math.min(maxVal, x)); } - public static float dot(float x1, float y1, float x2, float y2) { + public static double dot(double x1, double y1, double x2, double y2) { return x1 * x2 + y1 * y2; } - public float[] erosion(int seed, float x, float y, float dirX, float dirY) { - int gridX = Math.round(x); - int gridY = Math.round(y); - float noise = 0.0f; - float dirOutX = 0.0f; - float dirOutY = 0.0f; - float cumAmp = 0.0f; + public double[] erosion(int seed, double x, double y, double dirX, double dirY) { + int gridX = (int) Math.round(x); + int gridY = (int) Math.round(y); + double noise = 0.0f; + double dirOutX = 0.0f; + double dirOutY = 0.0f; + double cumAmp = 0.0f; for(int cellX = gridX - 1; cellX <= gridX + 1; cellX++) { for(int cellY = gridY - 1; cellY <= gridY + 1; cellY++) { - float cellHash = hash(seed, cellX, cellY); - float cellOffsetX = (float) (hashX(seed, cellHash) * jitter); - float cellOffsetY = (float) (hashY(seed, cellHash) * jitter); - float cellOriginDeltaX = (x - cellX) + cellOffsetX; - float cellOriginDeltaY = (y - cellY) + cellOffsetY; - float cellOriginDistSq = cellOriginDeltaX * cellOriginDeltaX + cellOriginDeltaY * cellOriginDeltaY; + double cellHash = hash(seed, cellX, cellY); + double cellOffsetX = hashX(seed, cellHash) * jitter; + double cellOffsetY = hashY(seed, cellHash) * jitter; + double cellOriginDeltaX = (x - cellX) + cellOffsetX; + double cellOriginDeltaY = (y - cellY) + cellOffsetY; + double cellOriginDistSq = cellOriginDeltaX * cellOriginDeltaX + cellOriginDeltaY * cellOriginDeltaY; if(cellOriginDistSq > maxCellDistSq) continue; // Skip calculating cells too far away - float ampTmp = (float) ((cellOriginDistSq * maxCellDistSqRecip) - 1); - float amp = ampTmp * ampTmp; // Decrease cell amplitude further away + double ampTmp = (cellOriginDistSq * maxCellDistSqRecip) - 1; + double amp = ampTmp * ampTmp; // Decrease cell amplitude further away cumAmp += amp; - float directionalStrength = dot(cellOriginDeltaX, cellOriginDeltaY, dirX, dirY) * TAU; - noise += (float) (MathUtil.cos(directionalStrength) * amp); - float sinAngle = (float) MathUtil.sin(directionalStrength) * amp; + double directionalStrength = dot(cellOriginDeltaX, cellOriginDeltaY, dirX, dirY) * TAU; + noise += MathUtil.cos(directionalStrength) * amp; + double sinAngle = MathUtil.sin(directionalStrength) * amp; dirOutX -= sinAngle * (cellOriginDeltaX + dirX); dirOutY -= sinAngle * (cellOriginDeltaY + dirY); } @@ -110,33 +110,33 @@ public float[] erosion(int seed, float x, float y, float dirX, float dirY) { dirOutX /= cumAmp; dirOutY /= cumAmp; } - return new float[]{ noise, dirOutX, dirOutY }; + return new double[]{ noise, dirOutX, dirOutY }; } - public float heightMap(long seed, float x, float y) { + public double heightMap(long seed, double x, double y) { double[] sample = sampler.noised(seed, x, y); - float height = (float) sample[0]; - float heightDirX = (float) sample[1]; - float heightDirY = (float) sample[2]; + double height = sample[0]; + double heightDirX = sample[1]; + double heightDirY = sample[2]; // Take the curl of the normal to get the gradient facing down the slope - float baseDirX = heightDirY * (float) slopeStrength; - float baseDirY = -heightDirX * (float) slopeStrength; + double baseDirX = heightDirY * slopeStrength; + double baseDirY = -heightDirX * slopeStrength; - float erosion = 0.0f; - float dirX = 0.0f; - float dirY = 0.0f; - float amp = 1.0f; - float cumAmp = 0.0f; - float freq = 1.0f; + double erosion = 0.0f; + double dirX = 0.0f; + double dirY = 0.0f; + double amp = 1.0f; + double cumAmp = 0.0f; + double freq = 1.0f; // Stack erosion octaves for(int i = 0; i < octaves; i++) { - float[] erosionResult = erosion((int) seed, - x * freq * (float) erosionFrequency, - y * freq * (float) erosionFrequency, - baseDirX + dirY * (float) branchStrength, - baseDirY - dirX * (float) branchStrength); + double[] erosionResult = erosion((int) seed, + x * freq * erosionFrequency, + y * freq * erosionFrequency, + baseDirX + dirY * branchStrength, + baseDirY - dirX * branchStrength); erosion += erosionResult[0] * amp; dirX += erosionResult[1] * amp * freq; dirY += erosionResult[2] * amp * freq; @@ -153,17 +153,17 @@ public float heightMap(long seed, float x, float y) { // Without masking, erosion noise in areas with small gradients tend to produce mounds, // this reduces erosion amplitude towards smaller gradients to avoid this if(slopeMask) { - float dirMagSq = dot(baseDirX, baseDirY, baseDirX, baseDirY); - float flatness = smoothstep((float) slopeMaskNoneSq, (float) slopeMaskFullSq, dirMagSq); + double dirMagSq = dot(baseDirX, baseDirY, baseDirX, baseDirY); + double flatness = smoothstep((double) slopeMaskNoneSq, slopeMaskFullSq, dirMagSq); erosion *= flatness; } - return (float) (height + erosion * erosionStrength); + return height + erosion * erosionStrength; } @Override public double getNoiseRaw(long seed, double x, double y) { - return heightMap(seed, (float) x, (float) y); + return heightMap(seed, x, y); } @Override From f1124aae6bcf1a5079674599cce6b53f9078dbeb Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 21:18:47 -0600 Subject: [PATCH 48/56] Update platform mod file versions and authors --- platforms/bukkit/common/src/main/resources/plugin.yml | 4 ++-- platforms/fabric/src/main/resources/fabric.mod.json | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/platforms/bukkit/common/src/main/resources/plugin.yml b/platforms/bukkit/common/src/main/resources/plugin.yml index e965d7dee..7c0ed151a 100644 --- a/platforms/bukkit/common/src/main/resources/plugin.yml +++ b/platforms/bukkit/common/src/main/resources/plugin.yml @@ -2,8 +2,8 @@ name: "Terra" main: "com.dfsek.terra.bukkit.TerraBukkitPlugin" version: "@VERSION@" load: "STARTUP" -author: dfsek +authors: ["dfsek", "duplexsystem", "Astrash", "solonovamax", "Sancires", "Aureus", "RogueShade"] website: "@WIKI@" -api-version: "1.20" +api-version: "1.21.1" description: "@DESCRIPTION@" folia-supported: true diff --git a/platforms/fabric/src/main/resources/fabric.mod.json b/platforms/fabric/src/main/resources/fabric.mod.json index bc5319452..592d4021a 100644 --- a/platforms/fabric/src/main/resources/fabric.mod.json +++ b/platforms/fabric/src/main/resources/fabric.mod.json @@ -5,7 +5,13 @@ "name": "Terra", "description": "@DESCRIPTION@", "authors": [ - "dfsek" + "dfsek", + "duplexsystem", + "Astrash", + "solonovamax", + "Sancires", + "Aureus", + "RogueShade" ], "contact": { "homepage": "@WIKI@", @@ -28,7 +34,7 @@ "depends": { "fabricloader": ">=0.16.5", "java": ">=21", - "minecraft": ">=1.20.6", + "minecraft": ">=1.21.1", "fabric": "*" } } \ No newline at end of file From f87b7c07d99f7ae1468890e36edfd559a1b8c6fb Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 22:27:53 -0600 Subject: [PATCH 49/56] Reformat --- platforms/bukkit/common/src/main/resources/plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platforms/bukkit/common/src/main/resources/plugin.yml b/platforms/bukkit/common/src/main/resources/plugin.yml index 7c0ed151a..782861cfe 100644 --- a/platforms/bukkit/common/src/main/resources/plugin.yml +++ b/platforms/bukkit/common/src/main/resources/plugin.yml @@ -2,7 +2,7 @@ name: "Terra" main: "com.dfsek.terra.bukkit.TerraBukkitPlugin" version: "@VERSION@" load: "STARTUP" -authors: ["dfsek", "duplexsystem", "Astrash", "solonovamax", "Sancires", "Aureus", "RogueShade"] +authors: [ "dfsek", "duplexsystem", "Astrash", "solonovamax", "Sancires", "Aureus", "RogueShade" ] website: "@WIKI@" api-version: "1.21.1" description: "@DESCRIPTION@" From f605ee1937f936617358732815776ad6561ec123 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 22:35:01 -0600 Subject: [PATCH 50/56] Remove Final from psuedoerosion template --- .../noise/PseudoErosionTemplate.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java index 4e2823271..f6d5706d8 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java @@ -15,55 +15,55 @@ public class PseudoErosionTemplate extends NoiseTemplate { @Value("octaves") @Default - private final int octaves = 4; + private int octaves = 4; @Value("lacunarity") @Default - private final double lacunarity = 2.0; + private double lacunarity = 2.0; @Value("gain") @Default - private final double gain = 0.5; + private double gain = 0.5; @Value("slope-strength") @Default - private final double slopeStrength = 1.0; + private double slopeStrength = 1.0; @Value("branch-strength") @Default - private final double branchStrength = 1.0; + private double branchStrength = 1.0; @Value("strength") @Default - private final double strength = 0.04; + private double strength = 0.04; @Value("erosion-frequency") @Default - private final double erosionFrequency = 0.02; + private double erosionFrequency = 0.02; @Value("sampler") private DerivativeNoiseSampler heightSampler; @Value("slope-mask.enable") @Default - private final boolean slopeMask = true; + private boolean slopeMask = true; @Value("slope-mask.none") @Default - private final double slopeMaskNone = -0.5; + private double slopeMaskNone = -0.5; @Value("slope-mask.full") @Default - private final double slopeMaskFull = 1; + private double slopeMaskFull = 1; @Value("jitter") @Default - private final double jitterModifier = 1; + private double jitterModifier = 1; @Value("average-impulses") @Default - private final boolean averageErosionImpulses = true; + private boolean averageErosionImpulses = true; @Override public PseudoErosionSampler get() { From 59d943b3eaaf95f91e33d3aa39b24bcef49b2ee5 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 22:38:17 -0600 Subject: [PATCH 51/56] Revert "Fix build" This reverts commit 10d723372daf14bc551159d050412c71c7f69a76. --- .../api/src/main/java/com/dfsek/terra/api/util/MathUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java index d12f31c47..6bf9b360d 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java @@ -23,8 +23,8 @@ public final class MathUtil { static final int lookupTableSize = 1 << lookupBits; private static final int lookupTableSizeWithMargin = lookupTableSize + 1; - private static final double tauOverLookupSize = Math.TAU / lookupTableSize; - static final double radianToIndex = (~(-1 << lookupBits) + 1) / Math.TAU; + private static final double tauOverLookupSize = TrigonometryConstants.TAU / lookupTableSize; + static final double radianToIndex = (~(-1 << lookupBits) + 1) / TrigonometryConstants.TAU; private static final long[] sinTable; static { From 6244ffca6368f94e4d8a73aab87794544edf4fb3 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 22:38:45 -0600 Subject: [PATCH 52/56] Revert "Sin/Cos Opts" This reverts commit 1d05f95f746639fdbc4c242d84aa4fcd93d666f4. --- .../com/dfsek/terra/api/util/MathUtil.java | 50 ++++++++----------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java index 6bf9b360d..2dd593b21 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java @@ -18,14 +18,22 @@ public final class MathUtil { * Epsilon for fuzzy floating point comparisons. */ public static final double EPSILON = 1.0E-5; - private static final int lookupBits = 14; + private static final int SIN_BITS, SIN_MASK, SIN_COUNT; + private static final double radFull, radToIndex; + private static final double degFull, degToIndex; + private static final double[] sin, cos; + static { + SIN_BITS = 12; + SIN_MASK = ~(-1 << SIN_BITS); + SIN_COUNT = SIN_MASK + 1; - static final int lookupTableSize = 1 << lookupBits; + radFull = Math.PI * 2.0; + degFull = 360.0; + radToIndex = SIN_COUNT / radFull; + degToIndex = SIN_COUNT / degFull; - private static final int lookupTableSizeWithMargin = lookupTableSize + 1; - private static final double tauOverLookupSize = TrigonometryConstants.TAU / lookupTableSize; - static final double radianToIndex = (~(-1 << lookupBits) + 1) / TrigonometryConstants.TAU; - private static final long[] sinTable; + sin = new double[SIN_COUNT]; + cos = new double[SIN_COUNT]; static { sinTable = new long[lookupTableSizeWithMargin]; @@ -33,36 +41,20 @@ public final class MathUtil { double d = i * tauOverLookupSize; sinTable[i] = Double.doubleToRawLongBits(StrictMath.sin(d)); } - } - - static double sinLookup(long index) { - // Trigonometric identity: sin(-x) = -sin(x) - // Given a domain of 0 <= x <= 2*pi, just negate the value if x > pi. - // This allows the sin table size to be halved. - long neg = (index & 0x8000000000000000L) << 32; - - // All bits set if (pi/2 <= x), none set otherwise - // Extracts the 31st bit from 'half' - long mask = (index << 33) >> 63; - // Trigonometric identity: sin(x) = sin(pi/2 - x) - long pos = (0x8000000000000001L & mask) + (index ^ mask); - - // Wrap the position in the table. Moving this down to immediately before the array access - // seems to help the Hotspot compiler optimize the bit math better. - pos &= 0x7fffffffffffffffL; - - // Fetch the corresponding value from the LUT and invert the sign bit as needed - // This directly manipulate the sign bit on the double bits to simplify logic - return Double.longBitsToDouble(sinTable[(int) pos] ^ neg); + // Four cardinal directions (credits: Nate) + for(int i = 0; i < 360; i += 90) { + sin[(int) (i * degToIndex) & SIN_MASK] = Math.sin(i * Math.PI / 180.0); + cos[(int) (i * degToIndex) & SIN_MASK] = Math.cos(i * Math.PI / 180.0); + } } public static double sin(double rad) { - return sinLookup((long) (rad * radianToIndex) & 0xFFFFFFFFL); + return sin[(int) (rad * radToIndex) & SIN_MASK]; } public static double cos(double rad) { - return sinLookup((long) (rad * radianToIndex + lookupTableSize) & 0xFFFFFFFFL); + return cos[(int) (rad * radToIndex) & SIN_MASK]; } public static double tan(double rad) { From 2c45ba91aafe3d453be74b67fd287b78e9a3dda2 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 22:40:37 -0600 Subject: [PATCH 53/56] Fix up commit --- .../src/main/java/com/dfsek/terra/api/util/MathUtil.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java index 2dd593b21..f972e7106 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java @@ -35,13 +35,6 @@ public final class MathUtil { sin = new double[SIN_COUNT]; cos = new double[SIN_COUNT]; - static { - sinTable = new long[lookupTableSizeWithMargin]; - for(int i = 0; i < lookupTableSizeWithMargin; i++) { - double d = i * tauOverLookupSize; - sinTable[i] = Double.doubleToRawLongBits(StrictMath.sin(d)); - } - // Four cardinal directions (credits: Nate) for(int i = 0; i < 360; i += 90) { sin[(int) (i * degToIndex) & SIN_MASK] = Math.sin(i * Math.PI / 180.0); From 6cc53beecbdd35731b076c18c3a0f4bee4bb0fa8 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Mon, 23 Sep 2024 23:14:35 -0600 Subject: [PATCH 54/56] Fix Sin/Cos --- .../api/src/main/java/com/dfsek/terra/api/util/MathUtil.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java index f972e7106..e57765f2e 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java @@ -35,6 +35,11 @@ public final class MathUtil { sin = new double[SIN_COUNT]; cos = new double[SIN_COUNT]; + for(int i = 0; i < SIN_COUNT; i++) { + sin[i] = Math.sin((i + 0.5f) / SIN_COUNT * radFull); + cos[i] = Math.cos((i + 0.5f) / SIN_COUNT * radFull); + } + // Four cardinal directions (credits: Nate) for(int i = 0; i < 360; i += 90) { sin[(int) (i * degToIndex) & SIN_MASK] = Math.sin(i * Math.PI / 180.0); From 1aa3ef813c3497a9999961a8c99172d444f1ea07 Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Tue, 24 Sep 2024 09:05:33 -0600 Subject: [PATCH 55/56] add default sampler to pseudoerosion --- .../noise/config/templates/noise/PseudoErosionTemplate.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java index f6d5706d8..cda91ec32 100644 --- a/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java +++ b/common/addons/config-noise-function/src/main/java/com/dfsek/terra/addons/noise/config/templates/noise/PseudoErosionTemplate.java @@ -4,6 +4,7 @@ import com.dfsek.tectonic.api.config.template.annotations.Value; import com.dfsek.terra.addons.noise.samplers.noise.PseudoErosionSampler; +import com.dfsek.terra.addons.noise.samplers.noise.simplex.OpenSimplex2Sampler; import com.dfsek.terra.api.config.meta.Meta; import com.dfsek.terra.api.noise.DerivativeNoiseSampler; @@ -43,7 +44,8 @@ public class PseudoErosionTemplate extends NoiseTemplate { private double erosionFrequency = 0.02; @Value("sampler") - private DerivativeNoiseSampler heightSampler; + @Default + private DerivativeNoiseSampler heightSampler = new OpenSimplex2Sampler(); @Value("slope-mask.enable") @Default From 13782bb51e72a15426190526ecb2a2653513e8bc Mon Sep 17 00:00:00 2001 From: Zoe Gidiere Date: Tue, 24 Sep 2024 09:11:43 -0600 Subject: [PATCH 56/56] Remforamt --- .../events/platform/CommandRegistrationEvent.java | 4 ++-- .../api/world/biome/generation/BiomeProvider.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java b/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java index 80088ff6d..3ad041c9b 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java +++ b/common/api/src/main/java/com/dfsek/terra/api/event/events/platform/CommandRegistrationEvent.java @@ -1,10 +1,10 @@ package com.dfsek.terra.api.event.events.platform; -import org.incendo.cloud.CommandManager; - import com.dfsek.terra.api.command.CommandSender; import com.dfsek.terra.api.event.events.Event; +import org.incendo.cloud.CommandManager; + public class CommandRegistrationEvent implements Event { private final CommandManager commandManager; diff --git a/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java b/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java index 3aed2b9ac..d049cd43b 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java +++ b/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java @@ -7,18 +7,18 @@ package com.dfsek.terra.api.world.biome.generation; -import com.dfsek.terra.api.util.Column; -import com.dfsek.terra.api.util.vector.Vector3; -import com.dfsek.terra.api.util.vector.Vector3Int; -import com.dfsek.terra.api.world.biome.Biome; -import com.dfsek.terra.api.world.info.WorldProperties; - import org.jetbrains.annotations.Contract; import java.util.Optional; import java.util.stream.Stream; import java.util.stream.StreamSupport; +import com.dfsek.terra.api.util.Column; +import com.dfsek.terra.api.util.vector.Vector3; +import com.dfsek.terra.api.util.vector.Vector3Int; +import com.dfsek.terra.api.world.biome.Biome; +import com.dfsek.terra.api.world.info.WorldProperties; + /** * Provides locations of biomes in a world.