Tutorials/Creating Custom Spawns: Difference between revisions

No edit summary
Line 1: Line 1:
{{TOC|right}}
{{TOC|right}}
== Preface ==
== Preface ==
This tutorial will show you how to create your own custom Pokémon spawns. The JSONs in the [[Spawn_Pool_World|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 <code>pack.mcmeta</code> of a datapack can also nullify the spawns from the base mod. You can use this to have total control over Pokémon spawns.  
This tutorial will show you how to create your own custom Pokémon spawns. The JSONs in the [[Spawn Pool World|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 <code>pack.mcmeta</code> 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.  
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 ===
=== Step 1: Arrange the folders for this addon ===
Line 18: Line 18:
*# Open the file and insert the following data:
*# Open the file and insert the following data:
  {
  {
   "<abbr title="This lets minecraft know that it is a datapack">pack</abbr>": {
   "<abbr title="This lets Minecraft know that it is a datapack">pack</abbr>": {
     "<abbr title="Here you will list the pack format number for a specific version of minecraft">pack_format</abbr>": <abbr title="As of 1.19.2, the current datapack format number is 10. But it will still load if this number isn't correct!">10</abbr>,
     "<abbr title="Here you will list the pack format number for a specific version of minecraft">pack_format</abbr>": <abbr title="As of 1.19.2, the current datapack format number is 10. But it will still load if this number isn't correct!">10</abbr>,
     "<abbr title="Here you will write a short description of your datapack">description</abbr>": "<abbr title="Your short datapack description">Example datapack description</abbr>"
     "<abbr title="Here you will write a short description of your datapack">description</abbr>": "<abbr title="Your short datapack description">Example datapack description</abbr>"
   }
   }
  }
  }
*# <li value=3> Save the file and prepare to put it in your addon folders
*# <li value=3> Save the file and prepare to place it in your addon folders.




Line 31: Line 31:
*# Open the file and insert the following data:
*# Open the file and insert the following data:
  {
  {
   "<abbr title="This lets minecraft know that it is a datapack">pack</abbr>": {
   "<abbr title="This lets Minecraft know that it is a datapack">pack</abbr>": {
     "<abbr title="Here you will list the pack format number for a specific version of minecraft">pack_format</abbr>": <abbr title="As of 1.19.2, the current datapack format number is 10. But it will still load if this number isn't correct!">10</abbr>,
     "<abbr title="Here you will list the pack format number for a specific version of Minecraft">pack_format</abbr>": <abbr title="As of 1.19.2, the current datapack format number is 10. But it will still load if this number isn't correct!">10</abbr>,
     "<abbr title="Here you will write a short description of your datapack">description</abbr>": "<abbr title="Your short datapack description">Example datapack description</abbr>"
     "<abbr title="Here you will write a short description of your datapack">description</abbr>": "<abbr title="Your short datapack description">Example datapack description</abbr>"
   },
   },
     "<abbr title="This tells minecraft that you want to filter some previously loaded data">filter</abbr>": {
     "<abbr title="This tells Minecraft that you want to filter some previously loaded data">filter</abbr>": {
       "<abbr title="This tells minecraft that you want to block the listed folders and its files">block</abbr>": [
       "<abbr title="This tells Minecraft that you want to block the listed folders and its files">block</abbr>": [
         {
         {
           "<abbr title="Here you will specify what namespaces you want to filter from. A namespace is the folder inside of the data folder for datapacks">namespace</abbr>": "<abbr title="Here you are specifying that you want to block some folders that are inside the cobblemon namespace">cobblemon</abbr>",
           "<abbr title="Here you will specify what namespaces you want to filter from. A namespace is the folder inside of the data folder for datapacks">namespace</abbr>": "<abbr title="Here you are specifying that you want to block some folders that are inside the cobblemon namespace">cobblemon</abbr>",
Line 44: Line 44:
     }
     }
  }
  }
*# <li value=3> Save the file and prepare to put it in your addon folders
*# <li value=3> Save the file and prepare to place it in your addon folders.


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


==== Folder Structure ====
==== 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 <code>pack.mcmeta</code> that you just made. You can create your own namespace instead of using the cobblemon name space if you don't want your spawn files to be affected from folder blocking.  
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 <code>pack.mcmeta</code> 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'''
'''Folder Structure'''
Line 56: Line 56:
** '''pack.mcmeta'''
** '''pack.mcmeta'''
**data
**data
***<abbr title="This is a name space. You can create your own if you need to">cobblemon</abbr>
***<abbr title="This is a namespace. You can create your own if you need to">cobblemon</abbr>
****spawn_pool_world
****spawn_pool_world
*****''<sub_folders>'' (optional)
*****''<sub_folders>'' (optional)
Line 67: Line 67:


Here is a list of options that some of the spawn properties can use:  
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 [https://gitlab.com/cable-mc/cobblemon/-/tree/main/common/src/main/resources/data/cobblemon/spawn_detail_presets Gitlab] or you can make your own [[Spawn_Detail_Presets|presets]].
* '''"presets"''': You can use any of these presets listed on the [https://gitlab.com/cable-mc/cobblemon/-/tree/main/common/src/main/resources/data/cobblemon/spawn_detail_presets Gitlab] or you can make your own [[Spawn Detail Presets|presets]].
* '''"context"''': You can choose between <code>"grounded"</code> for land spawns, <code>"submerged"</code> for underwater spawns, and <code>"surface"</code> for spawns on the surface of water or lava.
* '''"context"''': You can choose between <code>"grounded"</code> for land spawns, <code>"submerged"</code> for underwater spawns, and <code>"surface"</code> for spawns on the surface of water or lava.
* '''"bucket"''': The rarity pool of the Pokémon. You can choose <code>"common"</code>, <code>"uncommon"</code>, <code>"rare"</code>, or <code>"ultra-rare"</code>
* '''"bucket"''': The rarity pool of the Pokémon. You can choose <code>"common"</code>, <code>"uncommon"</code>, <code>"rare"</code>, or <code>"ultra-rare"</code>
Line 73: Line 73:
* '''"condition"''': You can use any of the conditions listed [https://gitlab.com/cable-mc/cobblemon/-/wikis/Spawner/Spawn-Condition here] to make Pokémon spawn
* '''"condition"''': You can use any of the conditions listed [https://gitlab.com/cable-mc/cobblemon/-/wikis/Spawner/Spawn-Condition here] to make Pokémon spawn
* '''"anticondition"''': You can use any of the conditions listed [https://gitlab.com/cable-mc/cobblemon/-/wikis/Spawner/Spawn-Condition here] to '''PREVENT''' a Pokémon from spawning
* '''"anticondition"''': You can use any of the conditions listed [https://gitlab.com/cable-mc/cobblemon/-/wikis/Spawner/Spawn-Condition here] to '''PREVENT''' a Pokémon from spawning
* '''"biomes"''': A subcategory of conditions and anticonditions. You can use biome id's or any [https://docs.google.com/document/d/1iB0EJSc2r6mRJXIo1n3XpHbZ5udwJVnrh2pXdhTyH8c/edit biome tags]. Should work with modded biome id's too!
* '''"biomes"''': A subcategory of conditions and anticonditions. You can use biome ids or any [https://docs.google.com/document/d/1iB0EJSc2r6mRJXIo1n3XpHbZ5udwJVnrh2pXdhTyH8c/edit biome tags]. Should work with modded biome id's too!




Line 84: Line 84:
# Edit the Pokémon's name '''and replace''' it with the Pokémon you want to make custom spawns for.
# 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.
#* If you stop after this step, then the replacement Pokémon will now spawn in the exact same conditions as the previous Pokémon.
# Replace the list of <code>"[[Spawn_Detail_Presets|presets]]"</code> if desired
# Replace the list of <code>"[[Spawn Detail Presets|presets]]"</code> if desired
#* A list of available presets can be found on the [https://gitlab.com/cable-mc/cobblemon/-/tree/main/common/src/main/resources/data/cobblemon/spawn_detail_presets Gitlab]
#* A list of available presets can be found on the [https://gitlab.com/cable-mc/cobblemon/-/tree/main/common/src/main/resources/data/cobblemon/spawn_detail_presets Gitlab]
# Replace the value for <code>"context"</code> if desired.
# Replace the value for <code>"context"</code> if desired.
Line 95: Line 95:
# Change the<code>"anticondition"</code> values if desired.
# Change the<code>"anticondition"</code> values if desired.
#* Sometimes you might even want to delete this section if it exists in the template.
#* Sometimes you might even want to delete this section if it exists in the template.
# Save the file
# Save the file.
# Place this new spawn file in the <code>spawn_pool_world</code> folder of your addon
# Place this new spawn file in the <code>spawn_pool_world</code> folder of your addon
# Repeat the whole process for any other spawn files you want to make!
# Repeat the whole process for any other spawn files you want to make!
Line 102: Line 102:
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.  
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.  
# Copy your addon folder and place it in the "datapacks" folder of your world in the Minecraft root directory.
# Copy your addon folder and place it in the "datapacks" folder of your world in the Minecraft root directory.
# Start up Minecraft
# Start up Minecraft.
# Load/create a '''Creative''' world save that contains your addon in the "datapack" folder.
# Load/create a '''Creative''' world save that contains your addon in the "datapack" folder.
# Check if your target Pokémon spawns where you assigned it to. You can use <code>/checkspawn <rarity></code> when in the assigned biome.  
# Check if your target Pokémon spawns where you assigned it to. You can use <code>/checkspawn <rarity></code> when in the assigned biome.  

Revision as of 16:12, 31 July 2023

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!