Class FileFixerUpper
java.lang.Object
net.minecraft.util.filefix.FileFixerUpper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataFixerBuilder.Resultprivate static final Stringprivate static final intprivate static final com.google.gson.Gsonprivate final intprivate static final org.slf4j.Loggerprivate static final Stringprivate static final String -
Constructor Summary
ConstructorsConstructorDescriptionFileFixerUpper(DataFixerBuilder.Result dataFixer, List<FileFix> fileFixes, int latestFileFixerVersion) -
Method Summary
Modifier and TypeMethodDescriptionprivate static Dynamic<?> addVersionsToLevelData(Dynamic<?> fixed, int toVersion) voidapplyFileFixers(UpgradeProgress upgradeProgress, int loadedVersion, int toVersion, Path basePath) applyFileFixersOnCow(UpgradeProgress upgradeProgress, int loadedVersion, int toVersion, Path worldFolder, Path fileFixDirectory, Path tempWorld) private static voidprivate voidcountFiles(List<FileFix> applicableFixers, UpgradeProgress upgradeProgress) private static voiddeleteDirectory(Path directory) static FileSystemCapabilitiesDynamic<?> fix(LevelStorageSource.LevelStorageAccess worldAccess, Dynamic<?> levelDataTag, UpgradeProgress upgradeProgress) Dynamic<?> fix(LevelStorageSource.LevelStorageAccess worldAccess, Dynamic<?> levelDataTag, UpgradeProgress upgradeProgress, int toVersion) getApplicableFixers(int fromVersion, int toVersion) booleanrequiresFileFixing(int levelDataVersion) startOrContinueFileFixing(UpgradeProgress upgradeProgress, int toVersion, Path worldFolder, Path tempWorld, Path fileFixDirectory, int loadedVersion) private static booleansupportsAtomicMove(Path dir) private static booleansupportsHardLinks(Path dir) protected static voidswapInFixedWorld(LevelStorageSource.LevelStorageAccess worldAccess, List<FileMove> moves, Path fileFixDirectory, Path tempWorld) static intworldVersionToFileFixerVersion(int levelDataVersion) private static voidprivate voidwriteUpdatedLevelData(Path worldFolder, int toVersion)
-
Field Details
-
FILE_FIXER_INTRODUCTION_VERSION
private static final int FILE_FIXER_INTRODUCTION_VERSION- See Also:
-
GSON
private static final com.google.gson.Gson GSON -
FILE_FIX_DIRECTORY_NAME
- See Also:
-
NEW_WORLD_TEMP_NAME
- See Also:
-
UPGRADE_IN_PROGRESS_NAME
- See Also:
-
LOGGER
private static final org.slf4j.Logger LOGGER -
dataFixer
-
fileFixes
-
latestFileFixerVersion
private final int latestFileFixerVersion
-
-
Constructor Details
-
FileFixerUpper
public FileFixerUpper(DataFixerBuilder.Result dataFixer, List<FileFix> fileFixes, int latestFileFixerVersion)
-
-
Method Details
-
worldVersionToFileFixerVersion
public static int worldVersionToFileFixerVersion(int levelDataVersion) -
requiresFileFixing
public boolean requiresFileFixing(int levelDataVersion) -
fix
public Dynamic<?> fix(LevelStorageSource.LevelStorageAccess worldAccess, Dynamic<?> levelDataTag, UpgradeProgress upgradeProgress) throws FileFixException - Throws:
FileFixException
-
fix
public Dynamic<?> fix(LevelStorageSource.LevelStorageAccess worldAccess, Dynamic<?> levelDataTag, UpgradeProgress upgradeProgress, int toVersion) throws FileFixException - Throws:
FileFixException
-
startOrContinueFileFixing
private List<FileMove> startOrContinueFileFixing(UpgradeProgress upgradeProgress, int toVersion, Path worldFolder, Path tempWorld, Path fileFixDirectory, int loadedVersion) throws IOException - Throws:
IOException
-
deleteDirectory
- Throws:
IOException
-
cleanup
-
applyFileFixersOnCow
private List<FileMove> applyFileFixersOnCow(UpgradeProgress upgradeProgress, int loadedVersion, int toVersion, Path worldFolder, Path fileFixDirectory, Path tempWorld) throws IOException - Throws:
IOException
-
applyFileFixers
public void applyFileFixers(UpgradeProgress upgradeProgress, int loadedVersion, int toVersion, Path basePath) throws IOException - Throws:
IOException
-
getApplicableFixers
-
countFiles
-
writeUpdatedLevelData
- Throws:
IOException
-
addVersionsToLevelData
-
swapInFixedWorld
protected static void swapInFixedWorld(LevelStorageSource.LevelStorageAccess worldAccess, List<FileMove> moves, Path fileFixDirectory, Path tempWorld) throws FileFixException - Throws:
FileFixException
-
writeMoves
private static void writeMoves(List<FileMove> moves, Path fromDirectory, Path toDirectory, Path filePath) throws IOException - Throws:
IOException
-
readMoves
private static List<FileMove> readMoves(Path fromDirectory, Path toDirectory, Path filePath) throws IOException - Throws:
IOException
-
detectFileSystemCapabilities
- Throws:
IOException
-
supportsAtomicMove
- Throws:
IOException
-
supportsHardLinks
- Throws:
IOException
-