Skip to content

Commit a06fca7

Browse files
committed
Fix Forge experimental world suppression not working on first reopen
1 parent 1580e75 commit a06fca7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.embeddedt.modernfix.forge.mixin.bugfix.extra_experimental_screen;
2+
3+
import com.mojang.serialization.Lifecycle;
4+
import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen;
5+
import net.minecraft.world.level.storage.PrimaryLevelData;
6+
import net.minecraft.world.level.storage.WorldData;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.injection.At;
9+
import org.spongepowered.asm.mixin.injection.ModifyArg;
10+
11+
@Mixin(CreateWorldScreen.class)
12+
public class CreateWorldScreenMixin {
13+
/**
14+
* Fix experimental world dialog still being shown the first time you reopen a world that was created
15+
* as experimental.
16+
*/
17+
@ModifyArg(method = "createNewWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/worldselection/WorldOpenFlows;createLevelFromExistingSettings(Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;Lnet/minecraft/server/ReloadableServerResources;Lnet/minecraft/core/RegistryAccess$Frozen;Lnet/minecraft/world/level/storage/WorldData;)V"), index = 3)
18+
private WorldData setExperimentalFlag(WorldData data) {
19+
if(data instanceof PrimaryLevelData pld && data.worldGenSettingsLifecycle() != Lifecycle.stable()) {
20+
pld.withConfirmedWarning(true);
21+
}
22+
return data;
23+
}
24+
}

0 commit comments

Comments
 (0)