Join our discord
In partnership with NodeCraft Logo NodeCraft


You are not logged in! Create an account or login to contribute! Log in here!

Difference between revisions of "External JSON files"

From Pixelmon Wiki
(Created page with "Certain aspects of Pixelmon, including special drops, NPCs, and structures, can be edited through [http://www.json.org/ JSON] files. These files can be accessed by...")
 
m
 
(46 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Certain aspects of Pixelmon, including [[special drops]], [[NPCs]], and [[structures]], can be edited through [http://www.json.org/ JSON] files. These files can be accessed by enabling the "useExternalJSONFiles" [[config]] setting and then starting ''Minecraft''. The external JSON files will be created at the path, "<''Minecraft'' directory>/pixelmon". JSON files can be edited with any plain text editor.
+
<seo title="External JSON files" metakeywords="Pixelmon Reforged external JSONs spawns drops moves rules NPCs stats structures shops shopkeepers" metadescription="A guide explaining how to enable and work with Pixelmon's external JSON files."/>
  
External JSON files should be edited carefully, and it is highly recommended to have knowledge of the JSON format before editing them. Incorrect editing of external JSON files can result in ''Minecraft'' crashing on startup. However, deleting an external JSON file will cause it to be regenerated with its default contents when ''Minecraft'' is started up again.
+
'''In 1.16 and 1.20, External JSON files are no longer present. Instead, the JSON files from the Mod can be edited and applied via Datapacks. Please see [https://pixelmonmod.com/wiki/Datapack_Creation this page] for further details and instructions on how to access the JSON files now. '''
==Special drops==
 
The [[special drops]] JSON file, "drops.json", is located at "<''Minecraft'' directory>/pixelmon/drops". It allows the special drop tables to be modified.
 
===drops.json===
 
drops.json contains three JSON arrays, "tier1", "tier2", and "tier3". Each array contains the [[item IDs]] of items that can be dropped in each special drop tier.
 
==NPCs==
 
[[NPC]] JSON files are located at "<''Minecraft'' directory/pixelmon/npcs". It contains files used to define NPC data such as spawning details, dialogue, [[shopkeeper]] [[Shopkeeper/Stock|stock]] and [[Shopkeeper/Sell prices|sell prices]], and [[NPC Trainer]] Pokémon.
 
  
NPC JSON files that contain dialogue must have file names suffixed by an underscore and the [http://minecraft.gamepedia.com/Language language code] that correspond to the language that the dialogue is written in. For example, the American English version of the [[Blacksmith]] JSON file is named "blacksmith_en_us.json". Server-side information, such as the possible Pokémon an NPC Trainer can have, is always obtained from the American English version of the JSON file. Files in other languages are only used to obtain translation-specific data such as dialogue.
+
Certain aspects of Pixelmon, including [[special drops]], [[NPCs]], and [[structures]], can be edited through [https://www.json.org/ JSON] files.  
===npcs.json===
+
These files can be accessed by enabling their respective <code>useExternalJSONFiles</code> [[config]] setting(s) and then starting ''Minecraft'', or restarting the server. Enabled external JSON files will show up under a newly-created <code>pixelmon</code> folder in <code>.minecraft</code> or the server root, depending on the side they're being edited on. JSON files can be edited with any plain text editor.
This JSON file contains data about NPC spawning rarity and which NPC JSON files to read. If a new NPC JSON file is created, the NPC must be added to this file in order for it to be registered by Pixelmon.
+
 
====rarities====
+
External JSON files should be edited carefully, as bad edits can potentially result in unexpected behavior from Pixelmon. Certain tools (such as [https://jsonlint.com/ JSONLint]) can be used to verify that files are formatted correctly. If necessary, deleting the external JSON folder and restarting will cause fresh files to be regenerated.
This array contains the rarities of each type of naturally spawning NPC ([[NPC Trainers]], [[move tutors]], [[move relearners]], [[traders]], and spawn [[shopkeepers]]).
+
 
*"type": The type of NPC to define the rarity of ("trainer", "tutor", "relearner", "trader", "shopkeeper").
+
After editing external JSON files, they will need to be reloaded in order for the changes to take effect. [[Shopkeeper]] and [[NPC]] files can be reloaded in-game via the <code>/pokereload</code> [[command]]. All external JSON files are reloaded after restarting the game or server.
*"rarity": The relative spawning rarity of the NPC. Spawning rarities are relative between NPC types; if one type of NPC has a rarity of 200 and a second type has a rarity of 100, the first NPC type will spawn twice as often as the second type.
+
 
The default NPC Trainer entry is shown below.
+
The following types of external files can currently be enabled:
    {
+
{|class="wikitable"
      "type": "trainer",
+
|-
      "rarity": 200
+
|style="text-align:center"|'''File type'''
    }
+
|style="text-align:center"|'''Description'''
====trainers====
+
|-
This array defines the [[NPC editor]] name, spawn rarity, and textures that an NPC Trainer will use.
+
|style="text-align:center"|[[Drop JSONs|Drops]]
*"name": The name of the NPC Trainer file, without the language code or ".json".
+
|Governs [[drops]] from bosses and wild Pokémon, as well as [[PokéLoot Chest]] loot.
*"rarity": The relative rarity of the NPC Trainer compared to other NPC Trainers. If this field is omitted, the NPC Trainer will not spawn naturally and can only be accessed using an NPC editor.
+
|-
*"textures": An array of skin textures that the NPC Trainer can use, excluding the ",png" extension. In a resource pack, textures are located at "assets/pixelmon/textures/steve".
+
|style="text-align:center"|[[Move JSONs|Moves]]
====Other arrays====
+
|Governs stats and rules for battle moves, as well as any graphical effects.
All other arrays in the npcs.json file define the NPC files to register for each type of NPC. The NPC files for each type are found at "<''Minecraft'' directory/pixelmon/npcs/<NPC type>". The only field of each array object is a "name" field, which defines the name of the JSON file to register. This name field should not contain the language code or ".json".
 
{|class="wikitable sortable"
 
!Array
 
!NPC type
 
!NPC folder
 
 
|-
 
|-
|style="text-align:center"|villagers
+
|style="text-align:center"|[[NPC JSONs|NPCs]]
|style="text-align:center"|[[Chatting NPC]]
+
|Governs many [[NPCs|Pixelmon NPC]]-related settings, from shop items and possible trades to translations.
|style="text-align:center"|villagers
 
 
|-
 
|-
|style="text-align:center"|list
+
|style="text-align:center"|[[Quests/Creation|Quests]]
|style="text-align:center"|[[NPC Trainer]]
+
|Governs default and custom [[quests]].
|style="text-align:center"|trainers
 
 
|-
 
|-
|style="text-align:center"|shopKeepers
+
|style="text-align:center"|[[Raid JSON|Raids]]
|style="text-align:center"|[[Shopkeeper]]
+
|Governs which Pokémon can spawn in [[Raid Den|Raid Dens]] in which biome and at what Star level(s).
|style="text-align:center"|shopKeepers
 
 
|-
 
|-
|style="text-align:center"|gymnpcs
+
|style="text-align:center"|[[Rule JSONs|Rules]]
|style="text-align:center"|[[Gym]] [[NPC Trainer]]
+
|Governs rulesets and tiers for competitive battling.
|style="text-align:center"|gyms
+
|-
 +
|style="text-align:center"|[[Spawning JSONs|Spawning]]
 +
|Governs what Pokémon spawn where, when and how. Includes [[fishing]], [[bosses]] and [[Spawner Cave Rock|Cave Rock]]/[[Pixelmon Grass|Grass]] spawns.
 +
|-
 +
|style="text-align:center"|[[Stat JSONs|Stats]]
 +
|Governs Pokémon stats, EV yields, [[Evolution|evolutions]], whether they can be mounted, move lists and more.
 +
|-
 +
|style="text-align:center"|[[Structure JSONs|Structures]]
 +
|Governs what [[structures]] can spawn, and where. Only affects new chunks.
 
|}
 
|}
==Structures==
+
 
[[Structure]] JSON files are located at <''Minecraft'' directory>/pixelmon/structures. This folder contains files that define Pixelmon structure aspects such as block composition, spawning details, and [[NPCs]] found inside the structures.
+
'''Please note:''' When Pixelmon is updated, internal copies of the above files may change but externals will not. If any are enabled, keep a close eye on the changelogs and refresh or update files where necessary. Outdated files may cause issues, or contain bugs that have since been fixed.
===structures.json===
 
This JSON file contains spawning data for all Pixelmon structures. It is split into three different arrays:
 
*"towns" contains structures that spawn in [[towns]].
 
*"gyms" contains [[Gyms]].
 
*"standalone" contains all other structures that are not Gyms and do not spawn in towns.
 
Each array consists of structures of that array's type. The three different types of structures each have different fields that can be specified.
 
====towns====
 
*"id": The ID of the structure when spawned via the /struc [[command]]
 
*"filename": The block snapshot file that defines the structure's block data, relative to "pixelmon/structures/towns".
 
*"weighting": Used to determine the relative rarity of spawning the structure
 
*"depth": How far into the ground the structure will spawn at.
 
*"maxnum": The maximum amount of structures of this type that can spawn in a town.
 
*"npcs": Data about NPCs that spawn in the structure.
 
**"type": The type of [[NPC]] to spawn.
 
**"data": Additional arguments modifying the NPC, such as "Main" or "Secondary" for [[shopkeepers]].
 
**"x": The x component of the coordinate where the NPC spawns, relative to the origin of the structure.
 
**"y": The y component of the coordinate where the NPC spawns, relative to the origin of the structure.
 
**"z": The z component of the coordinate where the NPC spawns, relative to the origin of the structure.
 
The town [[Pokémon Center]] JSON data is shown below as an example.
 
    {
 
      "id": "towncenter1",
 
      "filename": "pokecenter1.snapshot",
 
      "weighting": 20,
 
      "depth": 2,
 
      "maxnum": 1,
 
      "npcs": [
 
        {
 
          "type": "NurseJoy",
 
          "x": 9,
 
          "y": 3,
 
          "z": 7
 
        }
 
      ]
 
    }
 
====gyms====
 
*"id": The ID of the structure when spawned via the /struc [[command]]
 
*"filename": The block snapshot file that defines the Gym's block data, relative to "pixelmon/structures/gyms".
 
*"npcdata": The JSON file that defines the Gym's [[NPC]] spawning data, relative to "pixelmon/structures/gyms".
 
*"depth": How far into the ground the Gym will spawn at.
 
The [[Grass Gym]] JSON data is shown below as an example.
 
    {
 
      "id": "grassgym",
 
      "filename": "grassgym.snapshot",
 
      "npcdata": "grassgym.json",
 
      "depth": 8
 
    }
 
====standalone====
 
*"id": The ID of the structure when spawned via the /struc [[command]]
 
*"filename": The block snapshot file that defines the Gym's block data, relative to "pixelmon/structures/standalone".
 
*"biomes": The names of [[biomes]] that the structure can spawn in.
 
*"rarity": Used to determine the relative rarity of spawning the structure.
 
*"depth": How far into the ground the Gym will spawn at.
 
The [[frozen shrine]] JSON data is shown below as an example.
 
    {
 
      "id": "iceshrine",
 
      "filename": "shrine1.snapshot",
 
      "biomes": [ "Ice Plains Spikes", "Ice Plains", "Ice Mountains", "Cold Taiga M" ],
 
      "rarity": 20,
 
      "depth": 0
 
    }
 
===Block snapshots===
 
Block snapshot (.snapshot files) are used to define the blocks that make up a structure. They can be created and modified using the /psnapshot [[command]].
 
{{CommandSyntax}}
 
*/psnapshot load <file name>: Loads a set of blocks previously saved to a file by /snapshot save.
 
*/psnapshot set: Sets a corner of the area to save at the player's location. If there are already two corners set when this command is used, the corner that was set first will be overwritten by the new corner.
 
*/psnapshot save: Saves the blocks in the area defined by the two previously set corners. Two corners must already be set in order for this command to work. If a set of blocks was already previously saved, it will be overwritten by the newly saved set of blocks.
 
**/psnapshot save <file name>: Saves the blocks in the area like in /snapshot save. Also saves the blocks to a file (with the given name) in a "snapshots" folder inside the ''Minecraft'' folder. This file can be read back into ''Minecraft'' with the "load" argument.
 
*/psnapshot place: Copies the previously saved blocks and places them where the player is located.
 
*/psnapshot convert <file name>: Converts a snapshot created in ''Minecraft'' 1.8.9 and below into a snapshot compatible with ''Minecraft'' 1.10.2. This creates a new snapshot file with "-converted" appended to the original file name.
 
===Gym NPC data===
 
[[NPCs]] inside [[Gyms]] are defined in a JSON file separate from the structures.json file. This JSON file is split into two arrays:
 
*"npcs" for data about NPCs themselves.
 
*"pokemon" for data about possible Pokémon that [[NPC Trainers]] within the Gym can use.
 
====npcs====
 
*"name": The ID of the NPC. This leads to the corresponding file at "pixelmon/npcs/gyms", which defines most of the data about the NPC such as dialogue and skins.
 
*"type": The type of [[NPC]] to spawn.
 
*"rotation": The rotation (yaw) of the NPC relative to the Gym's rotation.
 
*"x": The x component of the coordinate where the NPC spawns, relative to the origin of the Gym structure.
 
*"y": The y component of the coordinate where the NPC spawns, relative to the origin of the Gym structure.
 
*"z": The z component of the coordinate where the NPC spawns, relative to the origin of the Gym structure.
 
An entry for one of the [[Grass Gym]]'s [[NPC Trainers]] is shown below.
 
    {
 
      "name": "grassgymbase",
 
      "type": "trainer",
 
      "tier": 3,
 
      "rotation": 90,
 
      "x": 13,
 
      "y": 3,
 
      "z": 25
 
    }
 
====pokemon====
 
*"name": The Pokémon's species.
 
*"minLevel": The minimum level that the [[NPC Trainer]] can be in order to potentially use this Pokémon.
 
*"maxLevel": The maximum level that the [[NPC Trainer]] can be in order to potentially use this Pokémon.
 
*"sets": Defines data about the Pokémon moves, [[Abilities]], [[held items]], [[Natures]], and [[EVs]]. It is possible to have multiple sets for a Pokémon.
 
**"move<number>": A move that the Pokémon can have in a certain moveslot. It is possible to define multiple moves for a moveslot; one will be randomly chosen when the Pokémon is used. Omitting a moveslot causes the Pokémon to have no move in the omitted slot.
 
**"helditem": Defines possible [[held items]] that the Pokémon can hold. Omitting this field causes the Pokémon to not hold an item.
 
**"nature": Defines possible [[Natures]] that the Pokémon can have. Omitting this field causes the Pokémon to randomly have any of the 24 Natures.
 
**"ev<stat>": Defines the number of [[EVs]] that the Pokémon will have for a certain stat.
 
**"doubleOnly": If set to true, the Pokémon will only appear if the [[NPC Trainer]] conducts double battles.
 
**"lead": If set to true, the [[NPC Trainer]] will attempt to send out this Pokémon first during battle.
 
An entry for one of the Pokémon inside the [[Grass Gym]] is shown below.
 
    {
 
      "name": "Servine",
 
      "minLevel": 17,
 
      "maxLevel": 35,
 
      "sets": [
 
        {
 
          "move1": [ "Giga Drain" ],
 
          "move2": [ "Reflect" ],
 
          "move3": [ "Light Screen" ],
 
          "move4": [ "Glare", "Leech Seed", "Synthesis", "Toxic" ],
 
          "heldItem": [ "pixelmon:light_clay" ],
 
          "nature": [ "Bold" ],
 
          "evHP": 252,
 
          "evDef": 252,
 
          "evSpDef": 4
 
        },
 
        {
 
          "minLevel": 31, // Only use the set at higher levels.
 
          "move1": [ "Leaf Blade" ],
 
          "move2": [ "Coil", "Swords Dance" ],
 
          "move3": [ "Aqua Tail", "Iron Tail", "Return" ],
 
          "move4": [ "Aqua Tail", "Iron Tail", "Return" ],
 
          "ability": [ "Overgrow" ],
 
          "heldItem": [ "pixelmon:muscle_band", "pixelmon:miracle_seed" ],
 
          "nature": [ "Adamant", "Jolly" ],
 
          "evAtk": 252,
 
          "evSpDef": 4,
 
          "evSpeed": 252
 
        }
 
      ]
 
    }
 

Latest revision as of 18:58, 25 March 2024


In 1.16 and 1.20, External JSON files are no longer present. Instead, the JSON files from the Mod can be edited and applied via Datapacks. Please see this page for further details and instructions on how to access the JSON files now.

Certain aspects of Pixelmon, including special drops, NPCs, and structures, can be edited through JSON files. These files can be accessed by enabling their respective useExternalJSONFiles config setting(s) and then starting Minecraft, or restarting the server. Enabled external JSON files will show up under a newly-created pixelmon folder in .minecraft or the server root, depending on the side they're being edited on. JSON files can be edited with any plain text editor.

External JSON files should be edited carefully, as bad edits can potentially result in unexpected behavior from Pixelmon. Certain tools (such as JSONLint) can be used to verify that files are formatted correctly. If necessary, deleting the external JSON folder and restarting will cause fresh files to be regenerated.

After editing external JSON files, they will need to be reloaded in order for the changes to take effect. Shopkeeper and NPC files can be reloaded in-game via the /pokereload command. All external JSON files are reloaded after restarting the game or server.

The following types of external files can currently be enabled:

File type Description
Drops Governs drops from bosses and wild Pokémon, as well as PokéLoot Chest loot.
Moves Governs stats and rules for battle moves, as well as any graphical effects.
NPCs Governs many Pixelmon NPC-related settings, from shop items and possible trades to translations.
Quests Governs default and custom quests.
Raids Governs which Pokémon can spawn in Raid Dens in which biome and at what Star level(s).
Rules Governs rulesets and tiers for competitive battling.
Spawning Governs what Pokémon spawn where, when and how. Includes fishing, bosses and Cave Rock/Grass spawns.
Stats Governs Pokémon stats, EV yields, evolutions, whether they can be mounted, move lists and more.
Structures Governs what structures can spawn, and where. Only affects new chunks.

Please note: When Pixelmon is updated, internal copies of the above files may change but externals will not. If any are enabled, keep a close eye on the changelogs and refresh or update files where necessary. Outdated files may cause issues, or contain bugs that have since been fixed.

© 2012 - 2025 Pixelmon Mod