Pixelmon NPC Editor Fixes¶
Fixes bugs in Pixelmon's in-game NPC editor so staff can build NPCs, save them as presets, and have them survive a restart.
What it does¶
Server-side fixes (work with the jar on the server only):
- Save to JSON works. Pixelmon saves presets to
world/generated/..., which is not a loaded datapack, so saved presets never loaded. This mod saves toworld/datapacks/<namespace>/data/<namespace>/pixelmon/npc/<path>.jsonand creates thepack.mcmetaif the datapack folder is new. - Presets from editor-made NPCs. Saving a preset from an NPC with no AI set crashed
(
NullPointerException). Now it saves. - NPCs no longer vanish on restart. An NPC whose team uses a bad PokePaste link (for example a
relative
/833f...URL) crashed while loading and was deleted. Now it loads with an empty team and logs a warning. - Interaction conditions save. Every condition started with an invalid provider key
(
pixelmon:test), so the server threw away the whole interaction save. Now the real key is used.
Editor screen fixes (only for staff whose client also has the jar):
- Edits made in the interaction editor are kept when you close it, and are sent to the server.
- The full editor shows for NPCs linked to a preset (Pixelmon showed a locked view).
- Closing the editor saves back to the linked preset.
- The preset tab tints the preset name aqua when the NPC is linked.
How players use it¶
Players do not interact with this mod.
Staff guide¶
There are no commands. Use Pixelmon's NPC editor as normal.
- Save to JSON, then run
/reload(or restart) so the new datapack preset loads. - Presets are saved under
world/datapacks/<namespace>/. They are normal datapack files: back them up, copy them to another server, or delete them. - For the interaction and linked-preset fixes, install the same jar in your own client's
mods/.
Configuration¶
None.
Data and storage¶
Presets saved through the editor go to
world/datapacks/<namespace>/data/<namespace>/pixelmon/npc/<path>.json, plus a generated
pack.mcmeta (pack format 48) when the datapack is new.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
| A saved preset does not appear | Datapacks not reloaded yet | /reload or restart |
| An NPC lost its team after a restart | Bad PokePaste URL in its preset | Look for [pixelmon-npc-editor-fixes] Preset party unavailable in the log and fix the URL |
| Interaction edits are lost | Your client does not have the mod | Install the jar on your client too |
| Server will not boot after a Pixelmon update | Mixins are required and target exact Pixelmon code |
Rebuild against the new Pixelmon |
Boot line: pixelmon-npc-editor-fixes loaded.
Maintainer notes¶
- Six mixins. Server:
SaveToPresetPacketMixin(cancels the stock handler and writes to the real datapack path),NPCPresetMixin(null-safefromNPCandapply),DataProviderInputTypeMixin(sets the real provider key inof()). Client:NPCInteractionEditorScreenMixin,NPCEditorScreenMixin,NPCEditorScreenPresetTabMixin. - The interaction editor bug was two bugs:
onClose()handed the open-time snapshot back to the parent screen, and nothing ever sentSendUpdatedInteractionDataPacket. - The editor close hook runs at
HEADso its packet goes out beforeNPCEditorClosedPacketclears the editing lock. - All mixins are
required. Older builds declared no Pixelmon dependency, so a Pixelmon mismatch was a fatal boot with a confusing error. The mod now declares its Pixelmon range.
Building¶
./gradlew build
Output: build/libs/pixelmonnpcfixes-<version>.jar.
Full command, permission and config tables: Reference.