External JSON files/Examples

This page contains examples of commonly made modifications to external JSON files.

Contents

Notes

  • The following examples assume that external JSON files have already been enabled and generated. If not, the external JSON files page contains information on how to generate the files.
  • You should understand the JSON format before editing these files. For example, you need to know that a JSON array has comma-separated values, with no comma after the last element. Failure to adhere to JSON formatting rules will result in the external JSON files failing to load.
  • It is recommended to use a JSON validator (such as this one) to make sure that all of your edits comply with the JSON format.
    • Note that comments (text between "/*" and "*/" are present in some external JSON files, although they are flagged as invalid by most validators. Before using a JSON validator, it is recommended that you remove any comments in the files that you edit. Removing these comments will not affect the data in the JSON file.
  • Minecraft (client or server) should not be open when editing external JSON files.
  • Back up external JSON files before editing, in case you mess up a file and want to revert it.

Making NPCs not spawn naturally

This examples makes all NPC types not spawn naturally; this will cause NPCs to only spawn inside structures or from an NPC editor.

  1. In npcs/npcs.json, find the "rarities" array
  2. Change all "rarity" fields to 0. The modified rarities array is shown below.
      "rarities": [
        {
          "type": "trainer",
          "rarity": 0
        },
        {
          "type": "tutor",
          "rarity": 0
        },
        {
          "type": "relearner",
          "rarity": 0
        },
        {
          "type": "trader",
          "rarity": 0
        },
        {
          "type": "shopkeeper",
          "rarity": 0
        }
      ],
    

Lowering an item's sell price

This example lowers the amount of PokéDollars obtained when selling a Rare Candy to a shopkeeper.

  1. In npcs/shopItems.json, find the "pixelmon:rare_candy" entry.
  2. Lower the "sell" field of the entry. The modified entry is shown below.
        {
          "name": "pixelmon:rare_candy",
          "sell": 500
        },
    

Making a Minecraft item sellable

This example allows diamonds to be sold to a shopkeeper.

  1. In npcs/shopItems.json, add the following entry to the "items" array. "name" is the item ID of the item.
        {
          "name": "minecraft:diamond",
          "sell": 1000
        }
    

Adding a boss Pokémon drop

This example allows uncommon and rare boss Pokémon to drop diamonds.

  1. In drops/bossdrops.json, find the "megadrops" array.
  2. Add the following entry to the array.
        "minecraft:diamond"
    

Adding a normal Pokémon drop

This example allows Bulbasaur to drop seeds.

  1. In drops/pokedrops.json, find the entry with the "pokemon" field, "Bulbasaur".
  2. Bulbasaur has a main drop, but no optional drops. Add the following entries to the object; these entries make Bulbasaur always drop 1-3 seeds.
            "optdrop1data": "minecraft:wheat_seeds",
            "optdrop1min": 1,
            "optdrop1max": 3,
    
  3. Bulbasaur's new pokedrops.json entry will look like the following.
        {
            "pokemon": "Bulbasaur",
            "maindropdata": "minecraft:vine",
            "maindropmin": 1,
            "maindropmax": 2,
            "optdrop1data": "minecraft:wheat_seeds",
            "optdrop1min": 1,
            "optdrop1max": 3,
            "raredropdata": "pixelmon:grass_gem",
            "raredropmin": 0,
            "raredropmax": 1
        },
    

Removing a normal Pokémon drop

This example prevents Unown from dropping Life Orbs.

  1. In drops/pokedrops.json, find the entry with the "pokemon" field, "Unown".
  2. Remove the following three entries from the array.
            "raredropdata": "pixelmon:life_orb",
            "raredropmin": 0,
            "raredropmax": 1
    
  3. Remove the comma at the end of the "optdrop1max" entry.
  4. The end result is an Unown entry that looks like the following.
        {
            "pokemon": "Unown",
            "maindropdata": "minecraft:end_stone",
            "maindropmin": 1,
            "maindropmax": 2,
            "optdrop1data": "minecraft:ender_pearl",
            "optdrop1min": 0,
            "optdrop1max": 1
        },
    

Removing special drops

This example removes mail from special drops.

  1. In drops/pokechestdrops.json, find the "tier1" array.
  2. Inside the array, find the entries for mail, shown below.
        "pixelmon:pokemail_air",
        "pixelmon:pokemail_bloom",
        ...
        "pixelmon:pokemail_wave",
        "pixelmon:pokemail_wood",
    
  3. Delete all of the mail entries from the array.

Adding a Minecraft item to special drops

This example adds diamonds as tier 2 special drops.

  1. In npcs/shopItems.json, add the following entry to the "items" array. "name" is the item ID of the item.
        {
          "name": "minecraft:diamond"
        }
    
  2. In drops/pokechestdrops.json, find the "tier2" array.
  3. Add the following entry to the array.
        "minecraft:diamond"
    

Making a structure not spawn naturally

This example makes haunted towers not spawn naturally.

  1. In structures/structures.json, find the entry labeled "hauntedtower".
  2. Remove the "biomes" field from the entry, as shown below.
        {
          "id": "hauntedtower",
          "filename": "hauntedtower.snapshot",
          "rarity": 20,
          "depth": 1
        }
    

Adding a shopkeeper

This example creates a new shopkeeper who sells only vitamins.

  1. In npcs/npcs.json, find the "shopKeepers" array.
  2. Add the following entry to the shopKeepers array.
        {
          "name": "vitaminseller"
        }
    
  3. In the npcs/shopKeepers folder, find the "pokemartmain1_en_us.json" file and duplicate it. Rename the duplicated file to "vitaminseller_en_us.json".
  4. Inside the new vitaminseller_en_us.json file, find the "type" field inside the "data" array. Change "PokemartMain" to "Spawn".
    • This makes the shopkeeper only spawn when using an NPC editor. Although the shopkeeper is now a spawn shopkeeper, it will not spawn naturally because no biomes are defined for it.
  5. Find the "items" array and remove all items inside of it.
  6. Add the six vitamin items to the items array. If you do not want prices fluctuating, add the "variation" field to each item and set it to false. The modified items array is shown below.
      "items": [
        {
          "name": "pixelmon:hp_up",
          "variation": false
        },
        {
          "name": "pixelmon:protein",
          "variation": false
        },
        {
          "name": "pixelmon:iron",
          "variation": false
        },
        {
          "name": "pixelmon:calcium",
          "variation": false
        },
        {
          "name": "pixelmon:zinc",
          "variation": false
        },
        {
          "name": "pixelmon:carbos",
          "variation": false
        }
      ]
    
  7. Start Minecraft and enter a world in Creative mode.
  8. Spawn in an NPC editor.
  9. Use the NPC editor to create a shopkeeper.
  10. Use the NPC editor on the shopkeeper to edit it.
  11. Cycle through the types of shopkeepers until you find the "vitaminseller" type.
  12. Select "Refresh Items" to reload the items that the shopkeeper is selling.
  13. Interact with the shopkeeper while not holding an item to verify that it is selling the six types of vitamins.

Adding a buy price to a Pixelmon item

This example adds a buy price to Rare Candy (which doesn't have one by default) and adds it to the stock of the "vitaminseller" shopkeeper created in the Adding a shopkeeper section.

  1. In npcs/shopItems.json, find the "pixelmon:rare_candy" entry.
  2. Add a "buy" field and a buy price to the entry. The new Rare Candy entry is shown below.
        {
          "name": "pixelmon:rare_candy",
          "buy": 20000,
          "sell": 2400
        },
    
  3. In npcs/shopKeepers/vitaminseller_en_us.json, add the following entry to the shopkeeper's "items" array.
        {
          "name": "pixelmon:rare_candy",
          "variation": false
        }
    

Adding a Minecraft item to a shopkeeper

This example adds a golden apple to the stock of the "vitaminseller" shopkeeper created in the Adding a shopkeeper section.

  1. In npcs/shopItems.json, add the following entry to the "items" array. "name" is the item ID of the item.
        {
          "name": "minecraft:golden_apple",
          "buy": 10000,
          "sell": 1000
        }
    
  2. In npcs/shopKeepers/vitaminseller_en_us.json, add the following entry to the shopkeeper's "items" array.
        {
          "name": "minecraft:golden_apple",
          "variation": false
        }
    

Adding a Minecraft item to a shopkeeper

This example adds a golden apple to the stock of the "vitaminseller" shopkeeper created in the Adding a shopkeeper section.

  1. In npcs/shopItems.json, add the following entry to the "items" array.
        {
          "name": "minecraft:golden_apple",
          "buy": 10000,
          "sell": 1000
        }
    
  2. In npcs/shopKeepers/vitaminseller_en_us.json, add the following entry to the shopkeeper's "items" array.
        {
          "name": "minecraft:golden_apple",
          "variation": false
        }
    

Adding an item with data values to a shopkeeper

This example adds an enchanted golden apple (with data value of 1) to the stock of the "vitaminseller" shopkeeper created in the Adding a shopkeeper section.

Note: Data values are also known as "damage values" or "metadata".

  1. In npcs/shopItems.json, add the following entry to the "items" array. The "id" field can be named anything that does not conflict with an existing item ID. The "itemData" field defines the data value of the item.
        {
          "id": "enchantedgoldenapple",
          "name": "minecraft:golden_apple",
          "itemData": 1,
          "buy": 50000,
          "sell": 5000
        }
    
  2. In npcs/shopKeepers/vitaminseller_en_us.json, add the following entry to the shopkeeper's "items" array. Note that the shopkeeper JSON's "name" field uses the "id" of the item defined in "shopItems.json"; using the "id" is required when defining any data values.
        {
          "name": "enchantedgoldenapple",
          "variation": false
        }
    

Adding an item with NBT data to a shopkeeper

This example adds an enchanted golden apple named "Notch apple" to the stock of the "vitaminseller" shopkeeper created in the Adding a shopkeeper section.

  1. In npcs/shopItems.json, add the following entry to the "items" array. The "nbtData" field contains NBT data for the item. Note that any quotation marks inside the NBT data string must be escaped (i.e., the quotation mark has a backslash ('\') preceding it).
        {
          "id": "notchapple",
          "name": "minecraft:golden_apple",
          "itemData": 1,
          "nbtData": "{display:{Lore:[\"Notch apple\"]}}",
          "buy": 50000,
          "sell": 5000
        }
    
  2. In npcs/shopKeepers/vitaminseller_en_us.json, add the following entry to the shopkeeper's "items" array.
        {
          "name": "notchapple",
          "variation": false
        }