Class LevelStorageSource
java.lang.Object
net.minecraft.world.level.storage.LevelStorageSource
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordclass -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprivate final Pathprivate final Pathprivate static final intprivate final DataFixerprivate static final org.slf4j.Loggerprivate static final PathMatcherstatic final Stringprivate final DirectoryValidator -
Constructor Summary
ConstructorsConstructorDescriptionLevelStorageSource(Path baseDir, Path backupDir, DirectoryValidator worldDirValidator, DataFixer fixerUpper) -
Method Summary
Modifier and TypeMethodDescriptioncreateAccess(String levelId) static LevelStorageSourcecreateDefault(Path path) private static @Nullable InstantgetFileModificationTime(Path path) private static longstatic LevelDataAndDimensionsgetLevelDataAndDimensions(LevelStorageSource.LevelStorageAccess worldAccess, Dynamic<?> levelDataTag, WorldDataConfiguration dataConfiguration, Registry<LevelStem> datapackDimensions, HolderLookup.Provider registryAccess) getLevelPath(String levelId) getName()static WorldLoader.PackConfiggetPackConfig(Dynamic<?> levelDataTag, PackRepository packRepository, boolean safeMode) private intbooleanisNewLevelIdAcceptable(String levelId) booleanlevelExists(String levelId) loadLevelSummaries(LevelStorageSource.LevelCandidates candidates) private LevelSummarymakeLevelSummary(Dynamic<?> dataTag, LevelStorageSource.LevelDirectory levelDirectory, boolean locked, int dataVersion) private static FeatureFlagSetparseFeatureFlagsFromSummary(Dynamic<?> tag) static DirectoryValidatorparseValidator(Path configPath) static WorldDataConfigurationreadDataConfig(Dynamic<?> levelData) static <T extends SavedData>
DataResult<T> readExistingSavedData(LevelStorageSource.LevelStorageAccess access, HolderLookup.Provider registryAccess, SavedDataType<T> savedDataType) private static CompoundTagreadLevelDataTagRaw(Path dataFile) private LevelSummaryreadLevelSummary(LevelStorageSource.LevelDirectory level, boolean locked) private static @Nullable TagreadLightweightData(Path dataFile) validateAndCreateAccess(String levelId) static voidwriteGameRules(WorldData worldData, Path worldFolder, GameRules gameRules) private static <T> voidwriteSavedData(Path worldFolder, DynamicOps<Tag> ops, SavedDataType<?> type, Codec<T> codec, T data) static voidwriteWorldGenSettings(RegistryAccess registryAccess, Path worldFolder, WorldGenSettings worldGenSettings)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
TAG_DATA
- See Also:
-
NO_SYMLINKS_ALLOWED
-
ALLOWED_SYMLINKS_CONFIG_NAME
- See Also:
-
DISK_SPACE_WARNING_THRESHOLD
private static final int DISK_SPACE_WARNING_THRESHOLD- See Also:
-
baseDir
-
backupDir
-
fixerUpper
-
worldDirValidator
-
-
Constructor Details
-
LevelStorageSource
public LevelStorageSource(Path baseDir, Path backupDir, DirectoryValidator worldDirValidator, DataFixer fixerUpper)
-
-
Method Details
-
parseValidator
-
createDefault
-
readDataConfig
-
getPackConfig
public static WorldLoader.PackConfig getPackConfig(Dynamic<?> levelDataTag, PackRepository packRepository, boolean safeMode) -
getLevelDataAndDimensions
public static LevelDataAndDimensions getLevelDataAndDimensions(LevelStorageSource.LevelStorageAccess worldAccess, Dynamic<?> levelDataTag, WorldDataConfiguration dataConfiguration, Registry<LevelStem> datapackDimensions, HolderLookup.Provider registryAccess) -
readExistingSavedData
public static <T extends SavedData> DataResult<T> readExistingSavedData(LevelStorageSource.LevelStorageAccess access, HolderLookup.Provider registryAccess, SavedDataType<T> savedDataType) -
writeGameRules
public static void writeGameRules(WorldData worldData, Path worldFolder, GameRules gameRules) throws IOException - Throws:
IOException
-
writeWorldGenSettings
public static void writeWorldGenSettings(RegistryAccess registryAccess, Path worldFolder, WorldGenSettings worldGenSettings) throws IOException - Throws:
IOException
-
writeSavedData
private static <T> void writeSavedData(Path worldFolder, DynamicOps<Tag> ops, SavedDataType<?> type, Codec<T> codec, T data) throws IOException - Throws:
IOException
-
getName
-
findLevelCandidates
- Throws:
LevelStorageException
-
loadLevelSummaries
public CompletableFuture<List<LevelSummary>> loadLevelSummaries(LevelStorageSource.LevelCandidates candidates) -
getStorageVersion
private int getStorageVersion() -
readLevelDataTagRaw
- Throws:
IOException
-
readLevelSummary
-
getFileModificationTime
-
getFileModificationTime
-
makeLevelSummary
private LevelSummary makeLevelSummary(Dynamic<?> dataTag, LevelStorageSource.LevelDirectory levelDirectory, boolean locked, int dataVersion) -
parseFeatureFlagsFromSummary
-
readLightweightData
- Throws:
IOException
-
isNewLevelIdAcceptable
-
levelExists
-
getLevelPath
-
getBaseDir
-
getBackupPath
-
validateAndCreateAccess
public LevelStorageSource.LevelStorageAccess validateAndCreateAccess(String levelId) throws IOException, ContentValidationException -
createAccess
- Throws:
IOException
-
getWorldDirValidator
-