diff --git a/src/main/java/com/gtnewhorizons/postea/api/CustomDataTransformContext.java b/src/main/java/com/gtnewhorizons/postea/api/CustomDataTransformContext.java index 14748ff..9bf9131 100644 --- a/src/main/java/com/gtnewhorizons/postea/api/CustomDataTransformContext.java +++ b/src/main/java/com/gtnewhorizons/postea/api/CustomDataTransformContext.java @@ -10,7 +10,8 @@ import com.gtnewhorizons.postea.utility.NbtItemStacks; /// A mod's custom world storage, as handed to [IVersionedTransformer#transformCustomData]. Stacks here may have /// string `id`s instead of numeric ones, and [#forEachItemStackTag] visits both. /// -/// @param storageId the storage's identity as its owner registered it, e.g. `"betterquesting:questDatabase"` +/// @param storageId the id the owning mod passed to [CustomDataReplacementManager#transform], e.g. +/// `"betterquesting:questDatabase"` /// @param storedVersion the version stamped under the transformer's key when the storage was written, or /// [IVersionedTransformer#UNSTAMPED] @Desugar diff --git a/src/main/java/com/gtnewhorizons/postea/api/IVersionedTransformer.java b/src/main/java/com/gtnewhorizons/postea/api/IVersionedTransformer.java index 600be3c..a7c1180 100644 --- a/src/main/java/com/gtnewhorizons/postea/api/IVersionedTransformer.java +++ b/src/main/java/com/gtnewhorizons/postea/api/IVersionedTransformer.java @@ -10,8 +10,10 @@ package com.gtnewhorizons.postea.api; /// registration order, before every other Postea pass. One whose output depends on another mod's versioned data /// must register after that mod. /// -/// Chunk transformers may run on chunk I/O threads, several at once for different chunks. They must touch no world -/// state beyond the context, and their own state must be safe to read concurrently. +/// Transformers may run off the server thread, several at once for different data: chunks on chunk I/O threads, players +/// on the network thread handling their login, and custom data on whichever thread the owning mod reads it. A +/// transformer must touch no world state beyond the context, and its own state must be safe to read concurrently. Each +/// call has the context's data to itself, and runs after the world's saved id map has been applied. /// /// Custom world storage offered through [CustomDataReplacementManager] is stamped the same way and reaches /// [#transformCustomData]. diff --git a/src/main/java/com/gtnewhorizons/postea/api/VersionedStackTransformer.java b/src/main/java/com/gtnewhorizons/postea/api/VersionedStackTransformer.java index c46fff7..92d54a9 100644 --- a/src/main/java/com/gtnewhorizons/postea/api/VersionedStackTransformer.java +++ b/src/main/java/com/gtnewhorizons/postea/api/VersionedStackTransformer.java @@ -10,7 +10,9 @@ import net.minecraft.nbt.NBTTagCompound; /// Each pass calls [#stackTransform] once, before visiting any stack. public abstract class VersionedStackTransformer implements IVersionedTransformer { - /// The rewrite applied to each stack tag in data stamped at `storedVersion`, or null when that data needs none. + /// The rewrite applied to each stack tag in data stamped at `storedVersion`, or null when that data needs none. In + /// custom world storage the rewrite also receives stacks whose `id` is a string name. A rewrite that matches only + /// numeric ids leaves those stacks unchanged. protected abstract Consumer stackTransform(int storedVersion); @Override diff --git a/src/main/java/com/gtnewhorizons/postea/mixins/early/MixinEntityPlayer.java b/src/main/java/com/gtnewhorizons/postea/mixins/early/MixinEntityPlayer.java index 859e3e0..fa77aa7 100644 --- a/src/main/java/com/gtnewhorizons/postea/mixins/early/MixinEntityPlayer.java +++ b/src/main/java/com/gtnewhorizons/postea/mixins/early/MixinEntityPlayer.java @@ -9,10 +9,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.gtnewhorizons.postea.mixins.interfaces.IPlayerStampsMixin; +/// Carries a player's version stamps to the entity `clonePlayer` builds on respawn, which is not read from NBT. @Mixin(EntityPlayer.class) public abstract class MixinEntityPlayer { - /// Copies the version stamps from the old player, because a respawned player is not built through NBT. @Inject(method = "clonePlayer", at = @At("RETURN"), require = 1) private void postea$carryVersionStamps(EntityPlayer oldPlayer, boolean respawn, CallbackInfo ci) { if ((Object) this instanceof IPlayerStampsMixin player && oldPlayer instanceof IPlayerStampsMixin old) { diff --git a/src/main/java/com/gtnewhorizons/postea/utility/HeightMaps.java b/src/main/java/com/gtnewhorizons/postea/utility/HeightMaps.java index cdd5e28..5b91e58 100644 --- a/src/main/java/com/gtnewhorizons/postea/utility/HeightMaps.java +++ b/src/main/java/com/gtnewhorizons/postea/utility/HeightMaps.java @@ -2,8 +2,11 @@ package com.gtnewhorizons.postea.utility; import net.minecraft.world.chunk.Chunk; -/// Rebuilds a chunk's height map from the chunk's own storage, which is safe on the chunk I/O thread. -/// `Chunk.generateHeightMap` is client-only and `generateSkylightMap` reaches into the world. +/// Rebuilds a chunk's height map from the chunk's own storage. `Chunk.generateHeightMap` is client-only and +/// `generateSkylightMap` reaches into the world. +/// +/// Block opacity comes from the position-aware `Block.getLightOpacity`, so a block that overrides it can read the world +/// from the chunk I/O thread. final class HeightMaps { private HeightMaps() {}