Skip to content

Commit 7d56a06

Browse files
committed
Update Cubiomes
1 parent 4e78fa7 commit 7d56a06

File tree

9 files changed

+101
-50
lines changed

9 files changed

+101
-50
lines changed

build.gradle

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,29 @@ dependencies {
5050
include modImplementation("dev.xpple:betterconfig-fabric:${project.betterconfig_version}")
5151
include modImplementation("dev.xpple:simplewaypoints:${project.simplewaypoints_version}")
5252

53-
// modRuntimeOnly("me.djtheredstoner:DevAuth-fabric:${project.devauth_version}") {
54-
// exclude group: 'net.fabricmc', module: 'fabric-loader'
55-
// }
56-
// productionRuntimeMods("me.djtheredstoner:DevAuth-fabric:${project.devauth_version}") {
57-
// exclude group: 'net.fabricmc', module: 'fabric-loader'
58-
// }
53+
modRuntimeOnly("me.djtheredstoner:DevAuth-fabric:${project.devauth_version}") {
54+
exclude group: 'net.fabricmc', module: 'fabric-loader'
55+
}
56+
productionRuntimeMods("me.djtheredstoner:DevAuth-fabric:${project.devauth_version}") {
57+
exclude group: 'net.fabricmc', module: 'fabric-loader'
58+
}
5959

6060
testImplementation platform("org.junit:junit-bom:${project.junit_version}")
6161
testImplementation 'org.junit.jupiter:junit-jupiter'
6262
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
6363
}
6464

65+
clean {
66+
delete fileTree("${projectDir}/src/main/java/com/github/cubiomes") {
67+
exclude '.gitkeep'
68+
}
69+
}
70+
6571
tasks.register('createJavaBindings', CreateJavaBindingsTask) {}
6672
compileJava.dependsOn('createJavaBindings')
6773

74+
createJavaBindings.dependsOn(clean)
75+
6876
tasks.register('generateBuildInfo', GenerateBuildInfoTask) {
6977
outputFile = new File(temporaryDir, "build_info.json")
7078
}

buildSrc/src/main/java/dev/xpple/seedmapper/buildscript/CreateJavaBindingsTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public abstract class CreateJavaBindingsTask extends Exec {
1313

1414
this.setWorkingDir(this.getProject().getRootDir());
1515
this.setStandardOutput(System.out);
16-
this.commandLine("./jextract/build/jextract/bin/jextract" + EXTENSION, "--include-dir", "src/main/c/cubiomes", "--output", "src/main/java", "--use-system-load-library", "--target-package", "com.github.cubiomes", "--header-class-name", "Cubiomes", "@includes.txt", "biomenoise.h", "biomes.h", "finders.h", "generator.h", "layers.h", "biomenoise.h", "biomes.h", "noise.h", "rng.h", "util.h", "quadbase.h", "xrms.h", "loot/items.h", "loot/logging.h", "loot/loot_functions.h", "loot/loot_table_context.h", "loot/loot_table_parser.h", "loot/loot_tables.h", "loot/mc_loot.h");
16+
this.commandLine("./jextract/build/jextract/bin/jextract" + EXTENSION, "--include-dir", "src/main/c/cubiomes", "--output", "src/main/java", "--use-system-load-library", "--target-package", "com.github.cubiomes", "--header-class-name", "Cubiomes", "@includes.txt", "biomenoise.h", "biomes.h", "finders.h", "generator.h", "layers.h", "biomenoise.h", "biomes.h", "noise.h", "terrainnoise.h", "rng.h", "util.h", "quadbase.h", "xrms.h", "loot/items.h", "loot/logging.h", "loot/loot_functions.h", "loot/loot_table_context.h", "loot/loot_table_parser.h", "loot/loot_tables.h", "loot/mc_loot.h");
1717
}
1818
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ betterconfig_version=2.5.0
2424
clientarguments_version=1.11.6
2525
simplewaypoints_version=1.2.0
2626

27-
devauth_version=1.2.1
27+
devauth_version=1.2.2
2828

2929
# Test dependencies
3030
junit_version=5.13.4

includes.txt

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
--include-struct SplineStack
1212
--include-struct SurfaceNoise
1313
--include-struct SurfaceNoiseBeta
14-
--include-struct TerrainNoiseParameters
14+
--include-struct TerrainNoise
15+
--include-function addSplineVal
1516
--include-function approxSurfaceBeta
1617
--include-function climateToBiome
18+
--include-function createFixSpline
1719
--include-function genBiomeNoiseBetaScaled
1820
--include-function genBiomeNoiseChunkSection
1921
--include-function genBiomeNoiseScaled
20-
--include-function generateColumn
21-
--include-function generateRegion
2222
--include-function genEndScaled
2323
--include-function genNetherScaled
2424
--include-function getBiomeDepthAndScale
@@ -31,34 +31,13 @@
3131
--include-function initBlendedNoise
3232
--include-function initSurfaceNoise
3333
--include-function initSurfaceNoiseBeta
34-
--include-function initTerrainNoise
3534
--include-function mapEnd
3635
--include-function mapEndBiome
3736
--include-function mapEndSurfaceHeight
3837
--include-function mapNether2D
3938
--include-function mapNether3D
40-
--include-function sampleBase3dNoise
41-
--include-function sampleBiomeNoise
42-
--include-function sampleBiomeNoiseBeta
43-
--include-function sampleCaveCheese
44-
--include-function sampleCaveEntrance
45-
--include-function sampleCaveLayer
46-
--include-function sampleClimatePara
47-
--include-function sampleEntrances
48-
--include-function sampleFinalDensity
49-
--include-function sampleNoiseColumn
50-
--include-function sampleNoiseParameters
51-
--include-function sampleNoodle
52-
--include-function samplePillars
53-
--include-function samplePreliminarySurfaceLevel
54-
--include-function sampleSlopedCheese
55-
--include-function sampleSpaghetti2d
56-
--include-function sampleSpaghetti3d
57-
--include-function sampleSpaghetti2dThicknessModulator
58-
--include-function sampleSpaghettiRoughness
5939
--include-function sampleSurfaceNoise
6040
--include-function sampleSurfaceNoiseBetween
61-
--include-function sampleUnderground
6241
--include-function setBetaBiomeSeed
6342
--include-function setBiomeSeed
6443
--include-function setClimateParaSeed
@@ -75,6 +54,10 @@
7554
--include-constant SAMPLE_NO_BIOME
7655
--include-constant SAMPLE_NO_DEPTH
7756
--include-constant SAMPLE_NO_SHIFT
57+
--include-constant SP_CONTINENTALNESS
58+
--include-constant SP_EROSION
59+
--include-constant SP_RIDGES
60+
--include-constant SP_WEIRDNESS
7861

7962
--include-function areSimilar
8063
--include-function biomeExists
@@ -948,6 +931,53 @@
948931
--include-function xOctaveLegacyInit
949932
--include-function xPerlinInit
950933

934+
--include-function initTerrainNoise
935+
--include-function generateColumn
936+
--include-function generateRegion
937+
--include-function sampleBase3dNoise
938+
--include-function sampleBiomeNoise
939+
--include-function sampleBiomeNoiseBeta
940+
--include-function sampleCaveCheese
941+
--include-function sampleCaveEntrance
942+
--include-function sampleCaveLayer
943+
--include-function sampleClimatePara
944+
--include-function sampleEntrances
945+
--include-function sampleFinalDensity
946+
--include-function sampleNoiseColumn
947+
--include-function sampleNoiseParameters
948+
--include-function sampleNoodle
949+
--include-function samplePillars
950+
--include-function samplePreliminarySurfaceLevel
951+
--include-function sampleSlopedCheese
952+
--include-function sampleSpaghetti2d
953+
--include-function sampleSpaghetti3d
954+
--include-function sampleSpaghetti2dThicknessModulator
955+
--include-function sampleSpaghettiRoughness
956+
--include-function sampleUnderground
957+
--include-function setupTerrainNoise
958+
--include-constant OTP_CAVE_ENTRANCE
959+
--include-constant OTP_CAVE_CHEESE
960+
--include-constant OTP_CAVE_LAYER
961+
--include-constant OTP_JAGGED
962+
--include-constant OTP_MAX
963+
--include-constant OTP_NOODLE
964+
--include-constant OTP_NOODLE_RIDGE_A
965+
--include-constant OTP_NOODLE_RIDGE_B
966+
--include-constant OTP_NOODLE_THICKNESS
967+
--include-constant OTP_PILLAR
968+
--include-constant OTP_PILLAR_RARENESS
969+
--include-constant OTP_PILLAR_THICKNESS
970+
--include-constant OTP_SPAGHETTI_2D
971+
--include-constant OTP_SPAGHETTI_2D_ELEVATION
972+
--include-constant OTP_SPAGHETTI_2D_MODULATOR
973+
--include-constant OTP_SPAGHETTI_2D_THICKNESS
974+
--include-constant OTP_SPAGHETTI_3D_1
975+
--include-constant OTP_SPAGHETTI_3D_2
976+
--include-constant OTP_SPAGHETTI_3D_RARITY
977+
--include-constant OTP_SPAGHETTI_3D_THICKNESS
978+
--include-constant OTP_SPAGHETTI_ROUGHNESS
979+
--include-constant OTP_SPAGHETTI_ROUGHNESS_MODULATOR
980+
951981
--include-function getOptimalAfk
952982
--include-function getQuadHutCst
953983
--include-function scanForQuads

src/main/java/dev/xpple/seedmapper/command/arguments/DensityFunctionArgument.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import com.github.cubiomes.BiomeNoise;
44
import com.github.cubiomes.Cubiomes;
5-
import com.github.cubiomes.TerrainNoiseParameters;
5+
import com.github.cubiomes.DoublePerlinNoise;
6+
import com.github.cubiomes.Generator;
7+
import com.github.cubiomes.TerrainNoise;
68
import com.google.common.collect.ImmutableMap;
79
import com.mojang.brigadier.StringReader;
810
import com.mojang.brigadier.arguments.ArgumentType;
@@ -26,7 +28,7 @@ public class DensityFunctionArgument implements ArgumentType<DensityFunctionArgu
2628
private static final Collection<String> EXAMPLES = Arrays.asList("overworld", "the_nether", "the_end");
2729

2830
public static final Map<String, DensityFunction> DENSITY_FUNCTIONS = ImmutableMap.<String, DensityFunction>builder()
29-
.put("overworld.base_3d_noise", (params, x, y, z) -> Cubiomes.sampleBase3dNoise(TerrainNoiseParameters.bln(params), x, y, z))
31+
.put("overworld.base_3d_noise", (params, x, y, z) -> Cubiomes.sampleBase3dNoise(TerrainNoise.base3dNoise(params), x, y, z))
3032
.put("overworld.caves.spaghetti_roughness_function", Cubiomes::sampleSpaghettiRoughness)
3133
.put("overworld.caves.spaghetti_2d_thickness_modulator", Cubiomes::sampleSpaghetti2dThicknessModulator)
3234
.put("overworld.caves.spaghetti_2d", Cubiomes::sampleSpaghetti2d)
@@ -81,18 +83,18 @@ public Collection<String> getExamples() {
8183

8284
@FunctionalInterface
8385
public interface DensityFunction {
84-
double compute(MemorySegment terrainNoiseParameters, int x, int y, int z);
86+
double compute(MemorySegment terrainNoise, int x, int y, int z);
8587
}
8688

8789
private static double computeSlopedCheese(MemorySegment params, int x, int y, int z) {
8890
try (Arena arena = Arena.ofConfined()) {
8991
MemorySegment np_param = arena.allocate(Cubiomes.C_FLOAT, 4);
90-
Cubiomes.sampleNoiseParameters(TerrainNoiseParameters.bn(params), x >> 2, z >> 2, np_param);
91-
double depth = Cubiomes.getSpline(BiomeNoise.sp(TerrainNoiseParameters.bn(params)), np_param) - 0.50375f;
92-
double factor = Cubiomes.getSpline(TerrainNoiseParameters.factorSpline(params), np_param);
93-
double jagged = Cubiomes.sampleDoublePerlin(TerrainNoiseParameters.jagged(params), x * 1500.0, 0, z * 1500.0);
92+
Cubiomes.sampleNoiseParameters(Generator.bn(TerrainNoise.g(params)), x >> 2, z >> 2, np_param);
93+
double depth = Cubiomes.getSpline(BiomeNoise.sp(Generator.bn(TerrainNoise.g(params))), np_param) - 0.50375f;
94+
double factor = Cubiomes.getSpline(TerrainNoise.factorSpline(params), np_param);
95+
double jagged = Cubiomes.sampleDoublePerlin(TerrainNoise.noises(params).asSlice(Cubiomes.OTP_JAGGED() * DoublePerlinNoise.sizeof()), x * 1500.0, 0, z * 1500.0);
9496
jagged = jagged >= 0.0 ? jagged : jagged / 2.0;
95-
jagged *= Cubiomes.getSpline(TerrainNoiseParameters.jaggednessSpline(params), np_param);
97+
jagged *= Cubiomes.getSpline(TerrainNoise.jaggednessSpline(params), np_param);
9698
return Cubiomes.sampleSlopedCheese(params, x, y, z, depth, factor, jagged);
9799
}
98100
}

src/main/java/dev/xpple/seedmapper/command/commands/HighlightCommand.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import com.github.cubiomes.Pos3;
1010
import com.github.cubiomes.Pos3List;
1111
import com.github.cubiomes.SurfaceNoise;
12-
import com.github.cubiomes.TerrainNoiseParameters;
12+
import com.github.cubiomes.TerrainNoise;
1313
import com.mojang.brigadier.CommandDispatcher;
1414
import com.mojang.brigadier.exceptions.CommandSyntaxException;
1515
import com.mojang.datafixers.util.Pair;
@@ -266,8 +266,11 @@ private static int highlightTerrain(CustomClientCommandSource source, int chunkR
266266
int minZ = minChunkZ << 4;
267267

268268
try (Arena arena = Arena.ofConfined()) {
269-
MemorySegment params = TerrainNoiseParameters.allocate(arena);
270-
if (Cubiomes.initTerrainNoise(params, seed.seed(), version, generatorFlags & Cubiomes.LARGE_BIOMES()) == 0) {
269+
MemorySegment params = TerrainNoise.allocate(arena);
270+
if (Cubiomes.setupTerrainNoise(params, version, generatorFlags) == 0) {
271+
throw CommandExceptions.INCOMPATIBLE_PARAMETERS_EXCEPTION.create();
272+
}
273+
if (Cubiomes.initTerrainNoise(params, seed.seed(), dimension) == 0) {
271274
throw CommandExceptions.INCOMPATIBLE_PARAMETERS_EXCEPTION.create();
272275
}
273276

src/main/java/dev/xpple/seedmapper/command/commands/SampleCommand.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dev.xpple.seedmapper.command.commands;
22

33
import com.github.cubiomes.Cubiomes;
4-
import com.github.cubiomes.TerrainNoiseParameters;
4+
import com.github.cubiomes.TerrainNoise;
55
import com.mojang.brigadier.CommandDispatcher;
66
import com.mojang.brigadier.exceptions.CommandSyntaxException;
77
import dev.xpple.seedmapper.command.CommandExceptions;
@@ -42,8 +42,11 @@ private static int sampleAll(CustomClientCommandSource source) throws CommandSyn
4242
BlockPos pos = BlockPos.containing(source.getPosition());
4343

4444
try (Arena arena = Arena.ofConfined()) {
45-
MemorySegment params = TerrainNoiseParameters.allocate(arena);
46-
if (Cubiomes.initTerrainNoise(params, seed.seed(), version, generatorFlags & Cubiomes.LARGE_BIOMES()) == 0) {
45+
MemorySegment params = TerrainNoise.allocate(arena);
46+
if (Cubiomes.setupTerrainNoise(params, version, generatorFlags) == 0) {
47+
throw CommandExceptions.INCOMPATIBLE_PARAMETERS_EXCEPTION.create();
48+
}
49+
if (Cubiomes.initTerrainNoise(params, seed.seed(), dimension) == 0) {
4750
throw CommandExceptions.INCOMPATIBLE_PARAMETERS_EXCEPTION.create();
4851
}
4952

@@ -68,8 +71,13 @@ private static int sampleDensity(CustomClientCommandSource source, DensityFuncti
6871
BlockPos pos = BlockPos.containing(source.getPosition());
6972

7073
try (Arena arena = Arena.ofConfined()) {
71-
MemorySegment params = TerrainNoiseParameters.allocate(arena);
72-
Cubiomes.initTerrainNoise(params, seed.seed(), version, generatorFlags & Cubiomes.LARGE_BIOMES());
74+
MemorySegment params = TerrainNoise.allocate(arena);
75+
if (Cubiomes.setupTerrainNoise(params, version, generatorFlags) == 0) {
76+
throw CommandExceptions.INCOMPATIBLE_PARAMETERS_EXCEPTION.create();
77+
}
78+
if (Cubiomes.initTerrainNoise(params, seed.seed(), dimension) == 0) {
79+
throw CommandExceptions.INCOMPATIBLE_PARAMETERS_EXCEPTION.create();
80+
}
7381
double density = densityFunction.compute(params, pos.getX(), pos.getY(), pos.getZ());
7482
source.sendFeedback(Component.translatable("command.sample.sampleDensity.success", ComponentUtils.formatXYZ(pos.getX(), pos.getY(), pos.getZ()), ComponentUtils.formatNumber(density)));
7583

src/main/resources/mixins.seedmapper.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"package": "dev.xpple.seedmapper.mixin",
44
"compatibilityLevel": "JAVA_21",
55
"client": [
6-
"ClientPacketListenerMixin",
76
"ChatScreenMixin",
7+
"ClientPacketListenerMixin",
88
"betterconfig.ConfigCommandClientMixin"
99
],
1010
"injectors": {

0 commit comments

Comments
 (0)