Fix corrupted and invalidly symlinked worlds crashing on level select (#10438)

This commit is contained in:
Jonathing authored and GitHub committed 2025-02-18 12:24:23 -08:00
1 parent bd96ff8777
commit 7ac8903a3b
2 files changed
+40 -7

No files matched your search

@@ -0,0 +1,22 @@
package net.minecraftforge.common.extensions;
import net.minecraft.world.level.storage.LevelSummary;
public interface IForgeLevelSummary {
private LevelSummary self() {
return (LevelSummary) this;
}
/**
* Checks if the Forge lifecycle of this level is experimental. This is used to render the experimental warning
* tooltip on the level select screen.
*
* @return {@code true} if the level is experimental
*/
default boolean isLifecycleExperimental() {
// NOTE: Because CorruptedLevelSummary and SymlinkLevelSummary can have null settings, we need to check it
var settings = this.self().getSettings();
return settings != null && settings.getLifecycle().equals(com.mojang.serialization.Lifecycle.experimental());
}
}