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

This commit is contained in:
Jonathing authored and GitHub committed 2025-02-12 17:03:06 -08:00
1 parent ef224bd2b8
commit f35dce7eb3
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());
}
}