Skip to content

Commit 37a4083

Browse files
committed
Convert to Mojmap.
1 parent 8fc8133 commit 37a4083

File tree

81 files changed

+1287
-1289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1287
-1289
lines changed

build.gradle

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ subprojects {
1414

1515
dependencies {
1616
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
17-
mappings loom.layered {
18-
it.mappings("net.fabricmc:yarn:${rootProject.yarn_mappings}:v2")
19-
it.mappings("dev.architectury:yarn-mappings-patch-forge:1.21.9+build.6")
20-
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:1.21+build.4")
21-
}
17+
mappings loom.officialMojangMappings()
2218
}
2319
}
2420

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
package com.terraformersmc.biolith.api.biome;
22

3-
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
3+
import net.minecraft.world.level.biome.Climate;
44

55
@SuppressWarnings("unused")
6-
public record BiolithFittestNodes<T>(MultiNoiseUtil.SearchTree.TreeLeafNode<T> ultimate, long ultimateDistance, MultiNoiseUtil.SearchTree.TreeLeafNode<T> penultimate, long penultimateDistance) {
7-
public BiolithFittestNodes(MultiNoiseUtil.SearchTree.TreeLeafNode<T> ultimate, long ultimateDistance) {
6+
public record BiolithFittestNodes<T>(Climate.RTree.Leaf<T> ultimate, long ultimateDistance, Climate.RTree.Leaf<T> penultimate, long penultimateDistance) {
7+
public BiolithFittestNodes(Climate.RTree.Leaf<T> ultimate, long ultimateDistance) {
88
this(ultimate, ultimateDistance, null, Long.MAX_VALUE);
99
}
1010

11-
public BiolithFittestNodes<T> of(MultiNoiseUtil.SearchTree.TreeLeafNode<T> ultimate, long ultimateDistance, MultiNoiseUtil.SearchTree.TreeLeafNode<T> penultimate, long penultimateDistance) {
11+
public BiolithFittestNodes<T> of(Climate.RTree.Leaf<T> ultimate, long ultimateDistance, Climate.RTree.Leaf<T> penultimate, long penultimateDistance) {
1212
return new BiolithFittestNodes<>(ultimate, ultimateDistance, penultimate, penultimateDistance);
1313
}
1414

15-
public BiolithFittestNodes<T> withPenultimate(MultiNoiseUtil.SearchTree.TreeLeafNode<T> penultimate, long penultimateDistance) {
15+
public BiolithFittestNodes<T> withPenultimate(Climate.RTree.Leaf<T> penultimate, long penultimateDistance) {
1616
return new BiolithFittestNodes<>(ultimate, ultimateDistance, penultimate, penultimateDistance);
1717
}
1818
}

common/src/main/java/com/terraformersmc/biolith/api/biome/BiomePlacement.java

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

33
import com.terraformersmc.biolith.api.biome.sub.Criterion;
44
import com.terraformersmc.biolith.impl.biome.BiomeCoordinator;
5-
import net.minecraft.registry.RegistryKey;
6-
import net.minecraft.world.biome.Biome;
7-
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
5+
import net.minecraft.resources.ResourceKey;
6+
import net.minecraft.world.level.biome.Biome;
7+
import net.minecraft.world.level.biome.Climate;
88

99
@SuppressWarnings("unused")
1010
public final class BiomePlacement {
@@ -18,7 +18,7 @@ private BiomePlacement() {
1818
* @param biome The biome to be placed
1919
* @param noisePoint A multi-noise point at which to place the biome
2020
*/
21-
public static void addEnd(RegistryKey<Biome> biome, MultiNoiseUtil.NoiseHypercube noisePoint) {
21+
public static void addEnd(ResourceKey<Biome> biome, Climate.ParameterPoint noisePoint) {
2222
BiomeCoordinator.END.addPlacement(biome, noisePoint, false);
2323
}
2424

@@ -28,7 +28,7 @@ public static void addEnd(RegistryKey<Biome> biome, MultiNoiseUtil.NoiseHypercub
2828
* @param biome The biome to be placed
2929
* @param noisePoint A multi-noise point at which to place the biome
3030
*/
31-
public static void addNether(RegistryKey<Biome> biome, MultiNoiseUtil.NoiseHypercube noisePoint) {
31+
public static void addNether(ResourceKey<Biome> biome, Climate.ParameterPoint noisePoint) {
3232
BiomeCoordinator.NETHER.addPlacement(biome, noisePoint, false);
3333
}
3434

@@ -38,7 +38,7 @@ public static void addNether(RegistryKey<Biome> biome, MultiNoiseUtil.NoiseHyper
3838
* @param biome The biome to be placed
3939
* @param noisePoint A multi-noise point at which to place the biome
4040
*/
41-
public static void addOverworld(RegistryKey<Biome> biome, MultiNoiseUtil.NoiseHypercube noisePoint) {
41+
public static void addOverworld(ResourceKey<Biome> biome, Climate.ParameterPoint noisePoint) {
4242
BiomeCoordinator.OVERWORLD.addPlacement(biome, noisePoint, false);
4343
}
4444

@@ -48,7 +48,7 @@ public static void addOverworld(RegistryKey<Biome> biome, MultiNoiseUtil.NoiseHy
4848
*
4949
* @param biome The biome to be removed
5050
*/
51-
public static void removeEnd(RegistryKey<Biome> biome) {
51+
public static void removeEnd(ResourceKey<Biome> biome) {
5252
BiomeCoordinator.END.addRemoval(biome, false);
5353
}
5454

@@ -57,7 +57,7 @@ public static void removeEnd(RegistryKey<Biome> biome) {
5757
*
5858
* @param biome The biome to be removed
5959
*/
60-
public static void removeNether(RegistryKey<Biome> biome) {
60+
public static void removeNether(ResourceKey<Biome> biome) {
6161
BiomeCoordinator.NETHER.addRemoval(biome, false);
6262
}
6363

@@ -66,7 +66,7 @@ public static void removeNether(RegistryKey<Biome> biome) {
6666
*
6767
* @param biome The biome to be placed
6868
*/
69-
public static void removeOverworld(RegistryKey<Biome> biome) {
69+
public static void removeOverworld(ResourceKey<Biome> biome) {
7070
BiomeCoordinator.OVERWORLD.addRemoval(biome, false);
7171
}
7272

@@ -77,7 +77,7 @@ public static void removeOverworld(RegistryKey<Biome> biome) {
7777
* @param target The biome to be replaced
7878
* @param biome The replacement biome
7979
*/
80-
public static void replaceEnd(RegistryKey<Biome> target, RegistryKey<Biome> biome) {
80+
public static void replaceEnd(ResourceKey<Biome> target, ResourceKey<Biome> biome) {
8181
BiomeCoordinator.END.addReplacement(target, biome, 1.0D, false);
8282
}
8383

@@ -89,7 +89,7 @@ public static void replaceEnd(RegistryKey<Biome> target, RegistryKey<Biome> biom
8989
* @param biome The replacement biome
9090
* @param proportion Approximate fraction of the target biome's volume to replace
9191
*/
92-
public static void replaceEnd(RegistryKey<Biome> target, RegistryKey<Biome> biome, double proportion) {
92+
public static void replaceEnd(ResourceKey<Biome> target, ResourceKey<Biome> biome, double proportion) {
9393
BiomeCoordinator.END.addReplacement(target, biome, proportion, false);
9494
}
9595

@@ -99,7 +99,7 @@ public static void replaceEnd(RegistryKey<Biome> target, RegistryKey<Biome> biom
9999
* @param target The biome to be replaced
100100
* @param biome The replacement biome
101101
*/
102-
public static void replaceNether(RegistryKey<Biome> target, RegistryKey<Biome> biome) {
102+
public static void replaceNether(ResourceKey<Biome> target, ResourceKey<Biome> biome) {
103103
BiomeCoordinator.NETHER.addReplacement(target, biome, 1.0D, false);
104104
}
105105

@@ -111,7 +111,7 @@ public static void replaceNether(RegistryKey<Biome> target, RegistryKey<Biome> b
111111
* @param biome The replacement biome
112112
* @param proportion Approximate fraction of the target biome's volume to replace
113113
*/
114-
public static void replaceNether(RegistryKey<Biome> target, RegistryKey<Biome> biome, double proportion) {
114+
public static void replaceNether(ResourceKey<Biome> target, ResourceKey<Biome> biome, double proportion) {
115115
BiomeCoordinator.NETHER.addReplacement(target, biome, proportion, false);
116116
}
117117

@@ -121,7 +121,7 @@ public static void replaceNether(RegistryKey<Biome> target, RegistryKey<Biome> b
121121
* @param target The biome to be replaced
122122
* @param biome The replacement biome
123123
*/
124-
public static void replaceOverworld(RegistryKey<Biome> target, RegistryKey<Biome> biome) {
124+
public static void replaceOverworld(ResourceKey<Biome> target, ResourceKey<Biome> biome) {
125125
BiomeCoordinator.OVERWORLD.addReplacement(target, biome, 1.0D, false);
126126
}
127127

@@ -133,7 +133,7 @@ public static void replaceOverworld(RegistryKey<Biome> target, RegistryKey<Biome
133133
* @param biome The replacement biome
134134
* @param proportion Approximate fraction of the target biome's volume to replace
135135
*/
136-
public static void replaceOverworld(RegistryKey<Biome> target, RegistryKey<Biome> biome, double proportion) {
136+
public static void replaceOverworld(ResourceKey<Biome> target, ResourceKey<Biome> biome, double proportion) {
137137
BiomeCoordinator.OVERWORLD.addReplacement(target, biome, proportion, false);
138138
}
139139

@@ -146,7 +146,7 @@ public static void replaceOverworld(RegistryKey<Biome> target, RegistryKey<Biome
146146
* @param biome The replacement biome
147147
* @param criterion Matching criteria for when to replace
148148
*/
149-
public static void addSubEnd(RegistryKey<Biome> target, RegistryKey<Biome> biome, Criterion criterion) {
149+
public static void addSubEnd(ResourceKey<Biome> target, ResourceKey<Biome> biome, Criterion criterion) {
150150
BiomeCoordinator.END.addSubBiome(target, biome, criterion, false);
151151
}
152152

@@ -158,7 +158,7 @@ public static void addSubEnd(RegistryKey<Biome> target, RegistryKey<Biome> biome
158158
* @param biome The replacement biome
159159
* @param criterion Matching criteria for when to replace
160160
*/
161-
public static void addSubNether(RegistryKey<Biome> target, RegistryKey<Biome> biome, Criterion criterion) {
161+
public static void addSubNether(ResourceKey<Biome> target, ResourceKey<Biome> biome, Criterion criterion) {
162162
BiomeCoordinator.NETHER.addSubBiome(target, biome, criterion, false);
163163
}
164164

@@ -170,7 +170,7 @@ public static void addSubNether(RegistryKey<Biome> target, RegistryKey<Biome> bi
170170
* @param biome The replacement biome
171171
* @param criterion Matching criteria for when to replace
172172
*/
173-
public static void addSubOverworld(RegistryKey<Biome> target, RegistryKey<Biome> biome, Criterion criterion) {
173+
public static void addSubOverworld(ResourceKey<Biome> target, ResourceKey<Biome> biome, Criterion criterion) {
174174
BiomeCoordinator.OVERWORLD.addSubBiome(target, biome, criterion, false);
175175
}
176176
}

common/src/main/java/com/terraformersmc/biolith/api/biome/sub/BiomeParameterTargets.java

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import com.mojang.serialization.Codec;
44
import com.terraformersmc.biolith.impl.biome.DimensionBiomePlacement;
5-
import net.minecraft.server.world.ServerWorld;
6-
import net.minecraft.util.StringIdentifiable;
7-
import net.minecraft.util.math.MathHelper;
8-
import net.minecraft.world.biome.source.BiomeCoords;
9-
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
5+
import net.minecraft.core.QuartPos;
6+
import net.minecraft.server.level.ServerLevel;
7+
import net.minecraft.util.Mth;
8+
import net.minecraft.util.StringRepresentable;
9+
import net.minecraft.world.level.biome.Climate;
1010

1111
/**
1212
* Available noise values in the {@link BiomeParameterTargets} enum:
@@ -21,7 +21,7 @@
2121
* <li>WEIRDNESS</li>
2222
* </ul>
2323
*/
24-
public enum BiomeParameterTargets implements StringIdentifiable {
24+
public enum BiomeParameterTargets implements StringRepresentable {
2525
/*
2626
* Do not add before or modify the order of the first six names;
2727
* they must be in the same order as Mojang's parameter arrays.
@@ -36,33 +36,33 @@ public enum BiomeParameterTargets implements StringIdentifiable {
3636
PEAKS_VALLEYS("peaks_valleys"),
3737
DEPTH_OCEAN("depth_ocean");
3838

39-
public static final Codec<BiomeParameterTargets> CODEC = StringIdentifiable.createCodec(BiomeParameterTargets::values);
39+
public static final Codec<BiomeParameterTargets> CODEC = StringRepresentable.fromEnum(BiomeParameterTargets::values);
4040
private final String name;
4141

4242
BiomeParameterTargets(String name) {
4343
this.name = name;
4444
}
4545

4646
/**
47-
* @param noisePoint A {@link MultiNoiseUtil.NoiseValuePoint} from which to select a value
47+
* @param noisePoint A {@link Climate.TargetPoint} from which to select a value
4848
* @return The noise value selected by this parameter target (long-type, not float-type)
4949
*/
50-
public long getNoiseValue(MultiNoiseUtil.NoiseValuePoint noisePoint) {
50+
public long getNoiseValue(Climate.TargetPoint noisePoint) {
5151
return
5252
switch (this) {
53-
case TEMPERATURE -> noisePoint.temperatureNoise();
54-
case HUMIDITY -> noisePoint.humidityNoise();
55-
case CONTINENTALNESS -> noisePoint.continentalnessNoise();
56-
case EROSION -> noisePoint.erosionNoise();
53+
case TEMPERATURE -> noisePoint.temperature();
54+
case HUMIDITY -> noisePoint.humidity();
55+
case CONTINENTALNESS -> noisePoint.continentalness();
56+
case EROSION -> noisePoint.erosion();
5757
case DEPTH -> noisePoint.depth();
58-
case WEIRDNESS -> noisePoint.weirdnessNoise();
59-
case PEAKS_VALLEYS -> BiomeParameterTargets.getPeaksValleysNoiseLong(noisePoint.weirdnessNoise());
58+
case WEIRDNESS -> noisePoint.weirdness();
59+
case PEAKS_VALLEYS -> BiomeParameterTargets.getPeaksValleysNoiseLong(noisePoint.weirdness());
6060
case DEPTH_OCEAN -> BiomeParameterTargets.getDepthWithOceanSurfaceLong(noisePoint.depth());
6161
};
6262
}
6363

6464
@Override
65-
public String asString() {
65+
public String getSerializedName() {
6666
return this.name;
6767
}
6868

@@ -96,32 +96,32 @@ public static long getPeaksValleysNoiseLong(long weirdness) {
9696
* @return The long-type calculated depth with ocean surface
9797
*/
9898
public static long getDepthWithOceanSurfaceLong(long depth) {
99-
ServerWorld world = DimensionBiomePlacement.getEvaluatingWorld();
99+
ServerLevel world = DimensionBiomePlacement.getEvaluatingWorld();
100100
int seaLevel = world.getSeaLevel();
101-
double bottom = world.getBottomY();
102-
double top = world.getTopYInclusive();
101+
double bottom = world.getMinY();
102+
double top = world.getMaxY();
103103
double bottomNew = 15000;
104104
double topNew = -15000;
105105

106106
return Math.max(depth,
107-
(long) MathHelper.clampedMap(BiomeCoords.toBlock(DimensionBiomePlacement.getEvaluatingBiomePos().getY()), bottom, top, bottomNew, topNew) -
108-
(long) MathHelper.clampedMap(seaLevel, bottom, top, bottomNew, topNew));
107+
(long) Mth.clampedMap(QuartPos.toBlock(DimensionBiomePlacement.getEvaluatingBiomePos().getY()), bottom, top, bottomNew, topNew) -
108+
(long) Mth.clampedMap(seaLevel, bottom, top, bottomNew, topNew));
109109
}
110110

111111
/**
112-
* @param range A {@link MultiNoiseUtil.ParameterRange parameter range} for which to find the center
112+
* @param range A {@link Climate.Parameter parameter range} for which to find the center
113113
* @return The long-type center of the provided parameter range
114114
*/
115-
public static long parameterCenter(MultiNoiseUtil.ParameterRange range) {
115+
public static long parameterCenter(Climate.Parameter range) {
116116
return (range.min() + range.max()) / 2L;
117117
}
118118

119119
/**
120-
* @param parameters A {@link MultiNoiseUtil.ParameterRange parameter range array} for which to find the center
121-
* @return The {@link MultiNoiseUtil.NoiseValuePoint center point} of the provided parameter range
120+
* @param parameters A {@link Climate.Parameter parameter range array} for which to find the center
121+
* @return The {@link Climate.TargetPoint center point} of the provided parameter range
122122
*/
123-
public static MultiNoiseUtil.NoiseValuePoint parametersCenterPoint(MultiNoiseUtil.ParameterRange[] parameters) {
124-
return new MultiNoiseUtil.NoiseValuePoint(
123+
public static Climate.TargetPoint parametersCenterPoint(Climate.Parameter[] parameters) {
124+
return new Climate.TargetPoint(
125125
parameterCenter(parameters[0]),
126126
parameterCenter(parameters[1]),
127127
parameterCenter(parameters[2]),
@@ -132,29 +132,29 @@ public static MultiNoiseUtil.NoiseValuePoint parametersCenterPoint(MultiNoiseUti
132132
}
133133

134134
/**
135-
* @param point1 A {@link MultiNoiseUtil.NoiseValuePoint noise point} for comparison
136-
* @param point2 A {@link MultiNoiseUtil.NoiseValuePoint noise point} for comparison
135+
* @param point1 A {@link Climate.TargetPoint noise point} for comparison
136+
* @param point2 A {@link Climate.TargetPoint noise point} for comparison
137137
* @param offset The long-type value of an offset to add to the squared distance
138138
* @return The long-type squared distance between the two noise points
139139
*/
140-
public static long getSquaredDistance(MultiNoiseUtil.NoiseValuePoint point1, MultiNoiseUtil.NoiseValuePoint point2, long offset) {
141-
return (MathHelper.square(point1.temperatureNoise() - point2.temperatureNoise()) +
142-
MathHelper.square(point1.humidityNoise() - point2.humidityNoise()) +
143-
MathHelper.square(point1.continentalnessNoise() - point2.continentalnessNoise()) +
144-
MathHelper.square(point1.erosionNoise() - point2.erosionNoise()) +
145-
MathHelper.square(point1.depth() - point2.depth()) +
146-
MathHelper.square(point1.weirdnessNoise() - point2.weirdnessNoise()) +
147-
MathHelper.square(offset)
140+
public static long getSquaredDistance(Climate.TargetPoint point1, Climate.TargetPoint point2, long offset) {
141+
return (Mth.square(point1.temperature() - point2.temperature()) +
142+
Mth.square(point1.humidity() - point2.humidity()) +
143+
Mth.square(point1.continentalness() - point2.continentalness()) +
144+
Mth.square(point1.erosion() - point2.erosion()) +
145+
Mth.square(point1.depth() - point2.depth()) +
146+
Mth.square(point1.weirdness() - point2.weirdness()) +
147+
Mth.square(offset)
148148
);
149149
}
150150

151151
/**
152-
* @param point1 A {@link MultiNoiseUtil.NoiseValuePoint noise point} for comparison
153-
* @param point2 A {@link MultiNoiseUtil.NoiseValuePoint noise point} for comparison
152+
* @param point1 A {@link Climate.TargetPoint noise point} for comparison
153+
* @param point2 A {@link Climate.TargetPoint noise point} for comparison
154154
* @return The long-type squared distance between the two noise points
155155
*/
156156
@SuppressWarnings("unused")
157-
public static long getSquaredDistance(MultiNoiseUtil.NoiseValuePoint point1, MultiNoiseUtil.NoiseValuePoint point2) {
157+
public static long getSquaredDistance(Climate.TargetPoint point1, Climate.TargetPoint point2) {
158158
return getSquaredDistance(point1, point2, 0L);
159159
}
160160
}

0 commit comments

Comments
 (0)