mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-26 06:53:05 +00:00
Doc cleanup
This commit is contained in:
5 files changed
+11
-45
No files matched your search
@@ -12,25 +12,18 @@ import com.gtnewhorizons.postea.utility.VersionedTransformerLog;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
/**
|
||||
* Versioned transformation of a mod's own world storage -- files outside chunks and player data, such as a quest
|
||||
* database or an ender chest table. Postea never reads or writes such files itself; the owning mod offers their
|
||||
* content at the moments it controls:
|
||||
* Manages applying an {@link IVersionedTransformer} to mods' custom storage files.
|
||||
* <ul>
|
||||
* <li>Call {@link #transform} once on the root read from disk, before consuming it, and persist that root (stamps
|
||||
* included) when writing the storage back.</li>
|
||||
* <li>A save path that rebuilds its NBT from scratch calls {@link #stamp} on the fresh root instead; once
|
||||
* {@link #transform} ran at load, the in-memory data is at the current version, so stamping current is correct.</li>
|
||||
* <li>A consumer that never writes the storage back (a read-only restore) calls only {@link #transform}: an
|
||||
* unstamped file re-transforms from the same baseline on every read, which is correct while its bytes never
|
||||
* change.</li>
|
||||
* <li>A save path that rebuilds its NBT from scratch calls {@link #stamp} on the fresh root instead.</li>
|
||||
* </ul>
|
||||
*/
|
||||
public abstract class CustomDataReplacementManager {
|
||||
|
||||
/**
|
||||
* Transforms {@code root} in place through every registered transformer whose stamp differs from its current
|
||||
* version, then writes the updated stamps onto {@code root}. Does nothing without a running server (a
|
||||
* multiplayer client). Throws
|
||||
* version, then writes the updated stamps onto {@code root}. Does nothing without a running server. Throws
|
||||
* {@link IllegalStateException} when called before the world's saved id mappings were applied.
|
||||
*/
|
||||
public static void transform(String storageId, NBTTagCompound root) {
|
||||
|
||||
@@ -8,10 +8,8 @@ import com.gtnewhorizons.postea.utility.NbtItemStacks;
|
||||
import com.gtnewhorizons.postea.utility.VersionStamps;
|
||||
|
||||
/**
|
||||
* A mod's own world storage as handed to {@link IVersionedTransformer#transformCustomData}: the NBT root the
|
||||
* owning mod read from disk, before it consumes the data. Unlike chunk and player data, stacks here may carry a
|
||||
* string {@code id} (a registry name, as quest databases store) instead of a numeric one;
|
||||
* {@link #forEachItemStackTag} visits both forms.
|
||||
* Context for a mod's custom world storage, used by {@link IVersionedTransformer#transformCustomData}. Stacks here
|
||||
* may have string {@code id}s instead of numeric ones; {@link #forEachItemStackTag} visits both.
|
||||
*/
|
||||
public final class CustomDataTransformContext {
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public interface IVersionedTransformer {
|
||||
default void transformPlayer(PlayerDataTransformContext ctx) {}
|
||||
|
||||
/**
|
||||
* Brings a mod's own world storage stamped at {@link CustomDataTransformContext#storedVersion()} to
|
||||
* Brings a mod's custom world storage stamped at {@link CustomDataTransformContext#storedVersion()} to
|
||||
* {@link #currentVersion()}. Stacks in such storage may carry a string {@code id} instead of a numeric one.
|
||||
*/
|
||||
default void transformCustomData(CustomDataTransformContext ctx) {}
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import com.gtnewhorizons.postea.api.IVersionedTransformer;
|
||||
|
||||
/**
|
||||
* The {@code POSTEA_VERSIONS} compound Postea keeps on a chunk's {@code Level} tag and on a player's root tag: one
|
||||
* The {@code POSTEA_VERSIONS} compound Postea keeps on data handled by {@link IVersionedTransformer}s, one
|
||||
* int per registered transformer key. Keys of transformers that are not registered in the running session are
|
||||
* carried through unchanged so a mod that is temporarily absent does not lose its stamps.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user