mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-25 22:44:51 +00:00
Tidy readiness gate and player hook docs
This commit is contained in:
4 files changed
+8
-8
No files matched your search
@@ -23,7 +23,7 @@ public abstract class CustomDataReplacementManager {
|
||||
|
||||
/// Transforms `root` in place through every registered transformer whose stamp differs from its current
|
||||
/// version, then writes the updated stamps onto `root`. Throws [IllegalStateException] when called before the
|
||||
/// world's info, and with it any saved id map, has loaded.
|
||||
/// world's info and saved id map have loaded.
|
||||
public static void transform(String storageId, NBTTagCompound root) {
|
||||
if (!serverRunning()) return;
|
||||
if (!IDRegistry.isMappingApplied()) {
|
||||
|
||||
@@ -12,11 +12,11 @@ import com.gtnewhorizons.postea.utility.IDRegistry;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
/// Opens [IDRegistry]'s mapping gate when `loadWorldInfo` returns on the server thread, after FML has applied any saved
|
||||
/// id map.
|
||||
@Mixin(SaveHandler.class)
|
||||
public abstract class MixinSaveHandler {
|
||||
|
||||
/// Returns come after FML's `handleWorldDataLoad` applies any saved id map, or when the world has no readable
|
||||
/// `level.dat`. FML applies the map only on the server thread.
|
||||
@Inject(method = "loadWorldInfo", at = @At("RETURN"), require = 1)
|
||||
private void postea$markWorldInfoLoaded(CallbackInfoReturnable<WorldInfo> cir) {
|
||||
if (FMLCommonHandler.instance()
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class IDRegistry {
|
||||
private static volatile boolean mappingApplied;
|
||||
|
||||
/// Loads the retired id table of the world about to load. [#registerWorldSpecificIDs] records into it until
|
||||
/// [#endWorld()]. [#isMappingApplied] stays false until [#onWorldInfoLoaded].
|
||||
/// [#endWorld()]. Resets [#isMappingApplied] to false.
|
||||
public static void beginWorld(File worldDirectory) {
|
||||
tableFile = new File(new File(worldDirectory, Postea.MODID), WorldIdTable.FILE_NAME);
|
||||
table = WorldIdTable.load(tableFile);
|
||||
@@ -57,8 +57,9 @@ public abstract class IDRegistry {
|
||||
ITEM_NAME_TO_ID.clear();
|
||||
}
|
||||
|
||||
/// Whether the loading world's info has loaded on the server thread. FML applies the world's saved id map, if
|
||||
/// it has one, during that load.
|
||||
/// Whether the loading world's id mappings are in place. [#onWorldInfoLoaded] sets it once the world's info, and
|
||||
/// with it any saved id map, has loaded on the server thread. [#onMappingUpdated] sets it when FML's remap event
|
||||
/// fires.
|
||||
public static boolean isMappingApplied() {
|
||||
return mappingApplied;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ import com.gtnewhorizons.postea.api.VersionedReplacementManager;
|
||||
|
||||
/// Runs versioned transformers over a server player's NBT as it is read, and stamps it as it is written.
|
||||
///
|
||||
/// Hooks `Entity.readFromNBT` and `writeToNBT`, which covers `playerdata/<uuid>.dat` and the single-player host's
|
||||
/// copy inside `level.dat`.
|
||||
/// Runs on every server player NBT read and write, which covers `playerdata` and the host player in `level.dat`.
|
||||
public final class PlayerDataFixerUtility {
|
||||
|
||||
private PlayerDataFixerUtility() {}
|
||||
|
||||
Reference in new issue
Block a user