Skip to content

Commit c10b56a

Browse files
committed
Update for Minecraft 25w43a.
- Update for Minecraft 25w43a - Followed PersistentState changes - State files renamed, therefore biome replacement order will not be preserved when upgrading from prior versions - No NeoForge or MinecraftForge yet
1 parent 0259323 commit c10b56a

File tree

10 files changed

+34
-32
lines changed

10 files changed

+34
-32
lines changed

common/src/main/java/com/terraformersmc/biolith/impl/biome/BiomeCoordinator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public static void handleServerStarting(MinecraftServer server) {
5959

6060
// When TerraBlender is present, it ignores our surface rules.
6161
// To avoid this, we submit a duplicate registration to TerraBlender (but only once).
62+
// TODO: Pretty sure this breaks for datapack surface rules added after first startup...
6263
if (BiolithCompat.COMPAT_TERRABLENDER && !registeredWithTerrablender) {
6364
Services.PLATFORM.getTerraBlenderCompat().registerSurfaceRules();
6465
registeredWithTerrablender = true;
@@ -81,21 +82,21 @@ public static void handleWorldStarting(ServerWorld world) {
8182
if (dimensionKey.isPresent()) {
8283
if (DimensionTypes.THE_END.equals(dimensionKey.get())) {
8384
if (END_STATE == null) {
84-
END_STATE = world.getPersistentStateManager().getOrCreate(BiolithState.getPersistentStateType("end"));
85+
END_STATE = world.getPersistentStateManager().getOrCreate(BiolithState.getPersistentStateType(world));
8586
END.serverReplaced(END_STATE, world);
8687
} else {
8788
Biolith.LOGGER.warn("More than one End dimension world created; cowardly ignoring '{}' in favor of '{}'", world.getRegistryKey().getValue(), END_STATE.getWorldId());
8889
}
8990
} else if (DimensionTypes.THE_NETHER.equals(dimensionKey.get())) {
9091
if (NETHER_STATE == null) {
91-
NETHER_STATE = world.getPersistentStateManager().getOrCreate(BiolithState.getPersistentStateType("nether"));
92+
NETHER_STATE = world.getPersistentStateManager().getOrCreate(BiolithState.getPersistentStateType(world));
9293
NETHER.serverReplaced(NETHER_STATE, world);
9394
} else {
9495
Biolith.LOGGER.warn("More than one Nether dimension world created; cowardly ignoring '{}' in favor of '{}'", world.getRegistryKey().getValue(), NETHER_STATE.getWorldId());
9596
}
9697
} else if (DimensionTypes.OVERWORLD.equals(dimensionKey.get())) {
9798
if (OVERWORLD_STATE == null) {
98-
OVERWORLD_STATE = world.getPersistentStateManager().getOrCreate(BiolithState.getPersistentStateType("overworld"));
99+
OVERWORLD_STATE = world.getPersistentStateManager().getOrCreate(BiolithState.getPersistentStateType(world));
99100
OVERWORLD.serverReplaced(OVERWORLD_STATE, world);
100101
} else {
101102
Biolith.LOGGER.warn("More than one Overworld dimension world created; cowardly ignoring '{}' in favor of '{}'", world.getRegistryKey().getValue(), OVERWORLD_STATE.getWorldId());

common/src/main/java/com/terraformersmc/biolith/impl/config/BiolithState.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private static <E> Codec<LinkedHashSet<E>> getLinkedHashSetCodec(Codec<E> entryC
2727
return entryCodec.listOf().xmap(LinkedHashSet::new, lhs -> lhs.stream().toList());
2828
}
2929

30-
public static Codec<BiolithState> getCodec(PersistentState.Context context) {
30+
public static Codec<BiolithState> getCodec(ServerWorld world) {
3131
return RecordCodecBuilder.create(
3232
(instance) -> instance.group(
3333
Codec.unboundedMap(RegistryKey.createCodec(RegistryKeys.BIOME), getLinkedHashSetCodec(RegistryKey.createCodec(RegistryKeys.BIOME))).optionalFieldOf("biome_replacements", Map.of())
@@ -37,32 +37,32 @@ public static Codec<BiolithState> getCodec(PersistentState.Context context) {
3737
)
3838
.apply(instance, (replacements, biomeReplacementsList) -> {
3939
if (!replacements.isEmpty()) {
40-
return unmarshall_v1(context, replacements);
40+
return unmarshall_v1(world, replacements);
4141
} else if (!biomeReplacementsList.isEmpty()) {
42-
return unmarshall_v0(context, biomeReplacementsList);
42+
return unmarshall_v0(world, biomeReplacementsList);
4343
} else {
44-
return new BiolithState(context);
44+
return new BiolithState(world);
4545
}
4646
}));
4747
}
4848

49-
public static PersistentStateType<BiolithState> getPersistentStateType(String name) {
49+
public static PersistentStateType<BiolithState> getPersistentStateType(ServerWorld world) {
5050
return new PersistentStateType<>(
51-
Biolith.MOD_ID + "_" + name + "_state",
52-
BiolithState::new,
53-
BiolithState::getCodec,
51+
Biolith.MOD_ID + "_state__" + world.getRegistryKey().getValue().toUnderscoreSeparatedString(),
52+
() -> new BiolithState(world),
53+
BiolithState.getCodec(world),
5454
null
5555
);
5656
}
5757

58-
public BiolithState(PersistentState.Context context) {
59-
this.world = context.getWorldOrThrow();
58+
public BiolithState(ServerWorld world) {
59+
this.world = world;
6060
}
6161

6262
// Legacy unmarshaller for upgrading from v0 to v1
6363
// Each map was stored as a flat ordered list with the key in position 0.
64-
private static BiolithState unmarshall_v0(PersistentState.Context context, List<LinkedHashSet<RegistryKey<Biome>>> biomeReplacementsList) {
65-
BiolithState state = new BiolithState(context);
64+
private static BiolithState unmarshall_v0(ServerWorld world, List<LinkedHashSet<RegistryKey<Biome>>> biomeReplacementsList) {
65+
BiolithState state = new BiolithState(world);
6666

6767
state.biomeReplacements.clear();
6868
biomeReplacementsList.forEach(list -> {
@@ -76,8 +76,8 @@ private static BiolithState unmarshall_v0(PersistentState.Context context, List<
7676
return state;
7777
}
7878

79-
private static BiolithState unmarshall_v1(PersistentState.Context context, Map<RegistryKey<Biome>, LinkedHashSet<RegistryKey<Biome>>> replacements) {
80-
BiolithState state = new BiolithState(context);
79+
private static BiolithState unmarshall_v1(ServerWorld world, Map<RegistryKey<Biome>, LinkedHashSet<RegistryKey<Biome>>> replacements) {
80+
BiolithState state = new BiolithState(world);
8181

8282
state.biomeReplacements.clear();
8383
state.biomeReplacements.putAll(replacements);

fabric/src/main/java/com/terraformersmc/biolith/impl/compat/TerraBlenderCompatFabric.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void registerSurfaceRules() {
6666
MaterialRules.MaterialRule rule = biolithRules.get(ruleOwner);
6767
if (rule != null) {
6868
if (namespace.equals("minecraft")) {
69-
Biolith.LOGGER.warn("Unable to modify surface rules of vanilla biomes via TerraBlender; dropping: {}", ruleOwner);
69+
SurfaceRuleManager.addToDefaultSurfaceRulesAtStage(terrablenderRuleCategory, SurfaceRuleManager.RuleStage.BEFORE_BEDROCK, 0, rule);
7070
continue;
7171
}
7272
try {

fabric/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@
4242
"depends": {
4343
"fabricloader": ">=0.15.3",
4444
"fabric-api": "*",
45-
"minecraft": ">=1.21.9 <1.22"
45+
"minecraft": ">1.21.10 <1.22"
4646
}
4747
}

forge/src/main/java/com/terraformersmc/biolith/impl/compat/TerraBlenderCompatForge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void registerSurfaceRules() {
6666
MaterialRules.MaterialRule rule = biolithRules.get(ruleOwner);
6767
if (rule != null) {
6868
if (namespace.equals("minecraft")) {
69-
Biolith.LOGGER.warn("Unable to modify surface rules of vanilla biomes via TerraBlender; dropping: {}", ruleOwner);
69+
SurfaceRuleManager.addToDefaultSurfaceRulesAtStage(terrablenderRuleCategory, SurfaceRuleManager.RuleStage.BEFORE_BEDROCK, 0, rule);
7070
continue;
7171
}
7272
try {

forge/src/main/resources/META-INF/mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ side = "BOTH"
2929
[[dependencies.biolith]]
3030
modId = "minecraft"
3131
mandatory = true
32-
versionRange = "[1.21.9,1.22)"
32+
versionRange = "[1.21.11,1.22)"
3333
ordering = "NONE"
3434
side = "BOTH"

gradle.properties

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ archives_base_name=biolith
77
mod_version=dev
88
maven_group=com.terraformersmc
99
loom.ignoreDependencyLoomVersionValidation=true
10-
enabled_platforms=fabric,forge,neoforge
10+
#enabled_platforms=fabric,forge,neoforge
11+
enabled_platforms=fabric
1112

1213
# Common
13-
minecraft_version=1.21.9
14-
yarn_mappings=1.21.9+build.1
14+
minecraft_version=25w43a
15+
yarn_mappings=25w43a+build.3
1516

1617
# Fabric
17-
fabric_api_version=0.134.0+1.21.9
18-
fabric_loader_version=0.17.2
18+
fabric_api_version=0.136.1+1.21.11
19+
fabric_loader_version=0.17.3
1920

2021
# Forge
2122
forge_version=1.21.9-59.0.0
@@ -56,12 +57,12 @@ default_release_type=alpha
5657
# CurseForge Metadata
5758
curseforge_slug=biolith
5859
curseforge_id=852512
59-
curseforge_game_versions=1.21.9
60+
curseforge_game_versions=1.21.11-snapshot
6061

6162
# Modrinth Metadata
6263
modrinth_slug=biolith
6364
modrinth_id=iGEl6Crx
64-
modrinth_game_versions=1.21.9, 1.21.10-rc1
65+
modrinth_game_versions=25w43a
6566
modrinth_mod_loaders=
6667

6768
# Discord Emotes

neoforge/src/main/java/com/terraformersmc/biolith/impl/compat/TerraBlenderCompatNeoForge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void registerSurfaceRules() {
6666
MaterialRules.MaterialRule rule = biolithRules.get(ruleOwner);
6767
if (rule != null) {
6868
if (namespace.equals("minecraft")) {
69-
Biolith.LOGGER.warn("Unable to modify surface rules of vanilla biomes via TerraBlender; dropping: {}", ruleOwner);
69+
SurfaceRuleManager.addToDefaultSurfaceRulesAtStage(terrablenderRuleCategory, SurfaceRuleManager.RuleStage.BEFORE_BEDROCK, 0, rule);
7070
continue;
7171
}
7272
try {

neoforge/src/main/resources/META-INF/neoforge.mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ side = "BOTH"
2929
[[dependencies.biolith]]
3030
modId = "minecraft"
3131
type = "required"
32-
versionRange = "[1.21.9,1.22)"
32+
versionRange = "[1.21.11,1.22)"
3333
ordering = "NONE"
3434
side = "BOTH"

settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ pluginManagement {
1919
rootProject.name = "biolith"
2020
include("common")
2121
include("fabric")
22-
include("forge")
23-
include("neoforge")
22+
//include("forge")
23+
//include("neoforge")

0 commit comments

Comments
 (0)