mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-28 07:56:04 +00:00
Documentation cleanup
This commit is contained in:
4 files changed
+10
-22
No files matched your search
@@ -519,17 +519,9 @@ public abstract class FMLIgnoreMissingMappingExample {
|
||||
|
||||
### 9. Versioned Chunk and Player Transformers
|
||||
|
||||
The transformers above answer "this content changed into that content". A versioned transformer answers a different
|
||||
question: "the meaning of my own stored values changed, and every chunk and every player must be brought forward
|
||||
exactly once per change". Register an `IVersionedTransformer` through `VersionedReplacementManager.register`, during
|
||||
mod loading and postInit at the latest.
|
||||
|
||||
Postea keeps a `POSTEA_VERSIONS` compound on each chunk's `Level` tag and on each player's root tag: one int per
|
||||
registered transformer key. Every chunk and player Postea saves is stamped with each transformer's
|
||||
`currentVersion()`, and at read time a transformer is invoked only when the stored stamp differs from its current
|
||||
version. A chunk that slept through five sessions of changes is therefore handed the version it was actually saved
|
||||
under, once, and a chunk already at the current version is skipped. Stamps belonging to transformers that are not
|
||||
registered in the running session are carried through untouched, so a temporarily absent mod does not lose them.
|
||||
Postea provides some API endpoints to allow mods to have versioned changes. The mod declares that it
|
||||
expects some version, and if Postea detects that a chunk or player was saved on a previous version, runs a transformer
|
||||
to bring them up-to-date. Register an `IVersionedTransformer` through `VersionedReplacementManager.register`.
|
||||
|
||||
> [!IMPORTANT]
|
||||
>
|
||||
@@ -599,14 +591,10 @@ public final class VersionedExample implements IVersionedTransformer {
|
||||
|
||||
### 10. Retired Ids
|
||||
|
||||
Whenever a world loads, every block or item name in its saved id map that no registered content answers to is
|
||||
recorded, with the id it held, in `<world>/postea/known-ids.json`. This exists because FML drops such a name from
|
||||
`level.dat` on the first save after its content disappears: from the second session onward the world no longer
|
||||
remembers that the name ever had an id, and a transformer keyed on it would silently stop running.
|
||||
Whenever a world loads, every block or item name in its saved id map that no longer exists is recorded, with the id it
|
||||
held, in `<world>/postea/known-ids.json`. This way, retired objects can still be referenced by transformers.
|
||||
|
||||
A retired id is dispatched to that name's transformers only while FML still blocks the id and no live block or item
|
||||
occupies it, so a name reclaimed by new content never gets its old transformers. When a name resolves only through
|
||||
retired ids, Postea logs it once per world load:
|
||||
When a name resolves only through retired ids, Postea logs it once per world load:
|
||||
|
||||
```
|
||||
Block ExtraUtilities:cobblestone_compressed is no longer registered; its transformers target retired id(s) [3402]
|
||||
|
||||
@@ -59,8 +59,8 @@ public final class ChunkTransformContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* The chunk's {@code Level} tag. Changes to its {@code TileEntities} and {@code Entities} lists are what the
|
||||
* game loads.
|
||||
* The chunk's {@code Level} tag. Changes to its {@code TileEntities} and {@code Entities} lists are loaded by
|
||||
* the game.
|
||||
*/
|
||||
public NBTTagCompound levelTag() {
|
||||
return levelTag;
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.gtnewhorizons.postea.api;
|
||||
public interface IVersionedTransformer {
|
||||
|
||||
/**
|
||||
* The stamp key, unique across all registered transformers, e.g. {@code "materiallib:idList"}.
|
||||
* The stamp key, unique across all registered transformers, e.g. {@code "examplemod:idList"}.
|
||||
*/
|
||||
String key();
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.gtnewhorizons.postea.utility.ChunkFixerUtility;
|
||||
public abstract class MixinAnvilChunkLoader {
|
||||
|
||||
// Forge-added funnel for sync and async loads; runs after relocation fix-ups and after ChunkAPI's own
|
||||
// readChunkFromNBT replacement, so one hook covers vanilla, NEID, EndlessIDs, and ChunkAPI.
|
||||
// readChunkFromNBT replacement, so covers vanilla, NEID, EndlessIDs, and ChunkAPI.
|
||||
@Inject(method = "checkedReadChunkFromNBT__Async", at = @At("RETURN"), remap = false, require = 1)
|
||||
private void postea$chunkHook(CallbackInfoReturnable<Object[]> cir) {
|
||||
Object[] data = cir.getReturnValue();
|
||||
|
||||
Reference in new issue
Block a user