Package com.minecolonies.core.util
Class BackUpHelper
java.lang.Object
com.minecolonies.core.util.BackUpHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringExport colony filename schemestatic longLast backup timer before the next is allowed -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanbackupColonyData(net.minecraft.core.HolderLookup.Provider provider) Backup the colonystatic StringexportColony(IColony colony) Exports a certain colony and its part of the world and colony data data to a zipstatic @NotNull FileGet save location for Minecolonies data, from the world/save directory.static voidLoads all colonies from the backup files, skips deleted colonies.static voidloadColonyBackup(int colonyId, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, boolean loadDeleted, boolean claimChunks) Load the colony backup by colony, also works for backups of deleted colonies.static voidloadManagerBackup(@NotNull net.minecraft.core.HolderLookup.Provider provider) Loads the colony managers backup filestatic voidLoads all colonies from backup files which the world cap is missing.static net.minecraft.nbt.CompoundTagloadNBTFromPath(@Nullable File file) Load a file and return the data as an CompoundTag.static voidmarkColonyDeleted(int colonyID, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimensionID) Marks a colony's backup file as deleted.static voidreclaimChunks(Colony colony) Reclaims chunks for a colonystatic voidsaveColonies(@NotNull net.minecraft.core.HolderLookup.Provider provider) Save all the Colonies.static voidsaveNBTToPath(@Nullable File file, @NotNull net.minecraft.nbt.CompoundTag compound) Save an CompoundTag to a file.
-
Field Details
-
FILENAME_EXPORT
Export colony filename scheme- See Also:
-
lastBackupTime
public static long lastBackupTimeLast backup timer before the next is allowed
-
-
Method Details
-
backupColonyData
public static boolean backupColonyData(@NotNull net.minecraft.core.HolderLookup.Provider provider) Backup the colony- Returns:
- true if succesful.
-
loadManagerBackup
public static void loadManagerBackup(@NotNull net.minecraft.core.HolderLookup.Provider provider) Loads the colony managers backup file -
loadMissingColonies
public static void loadMissingColonies()Loads all colonies from backup files which the world cap is missing. -
getSaveLocation
Get save location for Minecolonies data, from the world/save directory.- Returns:
- Save file for minecolonies.
-
saveNBTToPath
public static void saveNBTToPath(@Nullable @Nullable File file, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Save an CompoundTag to a file. Does so in a safe manner using an intermediate tmp file.- Parameters:
file- The destination file to write the data to.compound- The CompoundTag to write to the file.
-
loadNBTFromPath
Load a file and return the data as an CompoundTag.- Parameters:
file- The path to the file.- Returns:
- the data from the file as an CompoundTag, or null.
-
saveColonies
public static void saveColonies(@NotNull net.minecraft.core.HolderLookup.Provider provider) Save all the Colonies. -
markColonyDeleted
public static void markColonyDeleted(int colonyID, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimensionID) Marks a colony's backup file as deleted.- Parameters:
colonyID- id of the colony to deletedimensionID- dimension of the colony to delete
-
loadAllBackups
public static void loadAllBackups()Loads all colonies from the backup files, skips deleted colonies. -
loadColonyBackup
public static void loadColonyBackup(int colonyId, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, boolean loadDeleted, boolean claimChunks) Load the colony backup by colony, also works for backups of deleted colonies.- Parameters:
colonyId- of the colony.dimension- the colony dimension.loadDeleted- whether to load deleted colonies aswell.claimChunks- if chunks shall be claimed on loading.
-
reclaimChunks
Reclaims chunks for a colony- Parameters:
colony-
-
exportColony
Exports a certain colony and its part of the world and colony data data to a zip- Parameters:
colony- colony to export- Returns:
- file Path and name
-