Tutorials/Creating Custom Spawns

Revision as of 11:41, 14 October 2023 by Blob (talk | contribs) (added back Category:Tutorial)

Preface

This tutorial will show you how to create your own custom Pokémon spawns. The JSONs in the spawn pool world folder control how a Pokémon will spawn naturally. You can create or edit files for each Pokémon to give them new spawn conditions. Writing some extra data in the pack.mcmeta of a datapack can also nullify the spawns from the base mod. You can use this to have total control over Pokémon spawns.

Some third party tools exist to help with the mass production of spawn files. Help with mass spawn file production can be found on the Cobblemon Discord server.

Step 1: Arrange the folders for this addon

Depending on the kind of addon you want to make, you may want to make some slight adjustments to your folder structure of your spawn files. Generally, you can arrange your custom spawn files the same way other addons do. Your spawn files can have their own namespace if you don't want them to be affected by other mods.

Create a pack.mcmeta to suit your needs

Your pack.mcmeta can affect how your addon will work with other addons loaded before yours. A normal pack.mcmeta will have no affect on other addons, but adding some extra lines of data to it can completely nullify files in a specified folder.

Use one of the following pack.mcmeta examples below. Unless you have plans to negate all other spawns, like making your own custom region for something, then just make an addon friendly pack.mcmeta file!

  • The addon friendly pack.mcmeta - This one wont affect other addon files
    1. Create a new text file and name it pack.mcmeta
      • Ensure that it doesn't end in other file extensions like .txt
    2. Open the file and insert the following data:
{
 "pack": {
   "pack_format": 10,
   "description": "Example datapack description"
 }
}
  1. Save the file and prepare to place it in your addon folders.


  • The pack.mcmeta that negates all other spawns - Will prevent spawns in the base mod or addons loaded before it from working.
    1. Create a new text file and name it pack.mcmeta
      • Ensure that it doesn't end in other file extensions like .txt
    2. Open the file and insert the following data:
{
 "pack": {
   "pack_format": 10,
   "description": "Example datapack description"
 },
   "filter": {
     "block": [
       {
         "namespace": "cobblemon",
         "path": "spawn_pool_world"
       }
     ]
   }
}
  1. Save the file and prepare to place it in your addon folders.

Now, you can create the folders to place your files into.

Folder Structure

Now you can create the folder structure for your addon. Create a series of folders arranged like the following example. Don't forget to place your pack.mcmeta that you just made. You can create your own namespace instead of using the cobblemon namespace if you don't want your spawn files to be affected from folder blocking.

Folder Structure

  • (addon name)
    • pack.mcmeta
    • data
      • cobblemon
        • spawn_pool_world
          • <sub_folders> (optional)


All of the spawn files will be placed somewhere in the spawn pool world folder!

Step 2: Create your spawn files

There's a lot of data that can go into a spawn file. The data in spawn files can be rather self-explanatory. These files can be as simple as "spawn in the forest", or as complicated as "spawn at 2:30AM-3:00AM on top of clay during the new moon in an ocean biome that is south of spawn." The possibilities are limited by your creativity and understanding of spawn conditions.

Here is a list of options that some of the spawn properties can use:

  • "presets": You can use any of these presets listed on the Gitlab or you can make your own presets.
  • "context": You can choose between "grounded" for land spawns, "submerged" for underwater spawns, and "surface" for spawns on the surface of water or lava.
  • "bucket": The rarity pool of the Pokémon. You can choose "common", "uncommon", "rare", or "ultra-rare"
  • "weight": This determines how common the Pokémon will be inside of the assigned rarity pool. Generally, you can treat it like a scale of 0.1 to 10 on how rare it will be in that pool. You can use numbers higher than 10 if you really want that Pokémon to spawn more often.
  • "condition": You can use any of the conditions listed here to make Pokémon spawn
  • "anticondition": You can use any of the conditions listed here to PREVENT a Pokémon from spawning
  • "biomes": A subcategory of conditions and anticonditions. You can use biome ids or any biome tags. Should work with modded biome id's too!


To keep things simple, this part of the guide will show you how to create a spawn file from a template.

  1. Obtain a JSON to use as a template from the Gitlab.
    • Buneary is a great example template. The file is short, but Buneary is very common due to having 3 biome groups it can spawn in.
  2. Rename the file to anything you want. The name must be different than the original.
    • Example: bunearyspawn2
  3. Open the file and locate all the strings for "id" and "pokemon"
  4. Edit the Pokémon's name and replace it with the Pokémon you want to make custom spawns for.
    • If you stop after this step, then the replacement Pokémon will now spawn in the exact same conditions as the previous Pokémon.
  5. Replace the list of "presets" if desired
    • A list of available presets can be found on the Gitlab
  6. Replace the value for "context" if desired.
  7. Replace the value for "bucket" if desired.
  8. Change the values for "level". This is the minimum and maximum level it will spawn at.
  9. Replace the value for "weight" if desired.
    • Treat the number like a scale of 0.1 to 10 for its rarity bucket. This will keep your spawns balanced with other spawn files.
  10. Change the"condition" values if desired.
    • Most of the time, you'll want to change the list of "biomes"
  11. Change the"anticondition" values if desired.
    • Sometimes you might even want to delete this section if it exists in the template.
  12. Save the file.
  13. Place this new spawn file in the spawn_pool_world folder of your addon
  14. Repeat the whole process for any other spawn files you want to make!

Step 3: Test your addon in game

Load your addon in game to see if your custom spawn files are working. You can have your preferred file editor open to edit any relevant JSON files in the datapacks folder if needed.

  1. Copy your addon folder and place it in the "datapacks" folder of your world in the Minecraft root directory.
  2. Start up Minecraft.
  3. Load/create a Creative world save that contains your addon in the "datapack" folder.
  4. Check if your target Pokémon spawns where you assigned it to. You can use /checkspawn <rarity> when in the assigned biome.
    • You can run the command /locate biome <assigned biome> to get coordinates to the assigned biome. You can then click on the coordinates it gave you and be teleported instantly.
  5. Ensure that your target Pokémon at least appears in the checkspawn list after meeting its conditions.
  6. Make any desired edits to the data files and save. You need to quit to main menu, and load the world again if you want to see those changes.
    • The command for /reload does not work with Cobblemon addons unfortunately.

You should now have new natural Pokémon spawns!