Tutorials/Animation Replacement

Revision as of 10:20, 12 July 2023 by Frank The Farmer (talk | contribs) (Created page with "{{TOC|right}} == Preface == This tutorial will teach you how to add your own animations to official Cobblemon models made by the team. Due to the unique way the official Pokémon are coded, you can’t simply apply animations to them using a poser file. Instead, you can create a '''clone''' of the official model and use this clone to replace the official one. Knowledge of animation and creating custom Pokémon is highly recommended. === Step 1: Acquire all assets for yo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Preface

This tutorial will teach you how to add your own animations to official Cobblemon models made by the team. Due to the unique way the official Pokémon are coded, you can’t simply apply animations to them using a poser file. Instead, you can create a clone of the official model and use this clone to replace the official one. Knowledge of animation and creating custom Pokémon is highly recommended.

Step 1: Acquire all assets for your target Pokémon

You are going to need all of a Pokemon's assets so you can load them into Blockbench. You can obtain these assets by searching for them on the Gitlab or the mod's JAR file.

You will need all of the following files:

The resolver file will be used much later.

Step 2: Create your replacement animations

Now that you have the assets for your target Pokémon, you can edit them to your liking. Sometimes you may need to edit more than just the animations. You may need to change the properties of a bone to support your new animations. Remember to also include the animations that you don't want to edit in your animation list since you will be replacing the entire animation file!

  1. Load the target Pokémon's model, texture, and animations into Blockbench.
  2. Create any desired edits to the model and animations.
  3. Make sure you have an entire set of animations that can be assigned to a pokemon.
  4. Ensure each of your animations follow the naming format of animation.<pokemon>.<animation type>
  5. Keep Blockbench open and proceed to Step 3

If at any point you created or removed bones, the updated texture file will also need to be in your resource pack! You are expected to know how to fix this if you made such edits.

Step 3: Export the model and animations as "clones"

Due to the way official pokemon are coded, you cannot reference the model under the same name. It will cause issues when loading the resource pack. You will need to export your model with an alternate name. The animation file can have the same name as before.

  1. Export bedrock geometry of your model. File > Export > Export Bedrock Geometry
  2. Name this model file <pokemon>2.geo.json and save it somewhere.
  3. Open the animation tab in Blockbench.
  4. Export the animations. Animation > Export Animations
  5. Click Select All and click confirm
  6. Name this animation file <pokemon>.animation.json and save it somewhere.

The animation file can keep the same name because it can overwrite the one in the mod without issues.

Step 4: Create a new poser file

Because official models do not use a traditional poser file, you will have to create your own! This poser file needs to assign all the pose and quirk animations it had before. You may even need to assign animations it didn't have previously.

  1. Create a new poser JSON for your pokemon
  2. Be sure to assign all animations and quirks that you just exported!
  3. Make sure the assigned animations match the name scheme in the animation file!
  4. Save the file.
  5. Name this new poser file <pokemon>.json and save it somewhere
  6. Ensure that the file extension for this poser file is .json and not anything else like .txt

If you are unsure of how to write the poser file, you can reference the poser section of the Custom Pokémon Guide or seek help on the official Cobblemon discord.

If you are very familiar with poser files, you can reference the kotlin model files found on the Gitlab. They closely resemble the JSON format and can be useful to obtain the data for Portrait and Profile values of your target Pokémon!

Step 5: Edit the resolver file

The resolver file you acquired back in Step 1 will be repurposed into a new one. The resolver file controls what models, textures, and animations a pokemon species will use. You will mostly be changing load order values and the name of the model to <pokemon>2. This will effectively replace the in game model and animations with the one you made.

  1. Open the acquired resolver file in your preferred text editor
  2. Locate the string for "order"
  3. Change the value of "order" from 0 to 1
  4. Locate any lines in the json with the string for "model"
  5. Change the designated model to your clone.
    example:
    "model": "cobblemon:charmander.geo" > "model": "cobblemon:charmander2.geo"
  6. Save the file
  7. Change the name of this edited resolver to 1_<pokemon>_base and save it somewhere

The reason you change the "order" value from 0 to 1 is to let this data load after the main mods data. This should let it overwrite so your clone model will be the one to appear in game. If the official model referenced a poser file, the resource pack would fail to load.

The poser data should have already been written in the resolver despite the official models not being able to use a poser JSON. If it is not, then be sure to include a string for "poser" above the line for "model" and assign the poser you made.

There may be certain cases where order value and the name of the resolver may need a number higher than 1. This is usually the case for pokemon with gender differences.

Step 6: Arrange the asset files into a resource pack

You should have a new resolver, poser, model, and animation file. You simply need to arrange these files into a resource pack now. Make sure your folder names and locations are exactly the same as the main mod's. Some folders may include the pokemon's national pokedex number.

  1. Create a resource pack with the following layout:

Folder Structure

  • (resource pack name)
    • assets
      • cobblemon
        • bedrock
          • pokemon
            • animations
              • <target pokemon folder>
                • <pokemon>.animation.json
            • models
              • <target pokemon folder>
                • <pokemon>2.geo.json
            • posers
              • <pokemon>.json
            • resolvers
              • <target pokemon folder>
                • 1_<pokemon>_base.json
    • pack.mcmeta
    • pack.png (optional)

Step 7: Test your resource pack in game

Load your resource pack in game to see if the animations have successfully been replaces. You can have Blockbench open to edit the animation file in the resourcepacks folder if needed.

  1. Copy your pack folder and place it in the "resourcepacks" folder in the Minecraft root directory.
  2. Start up Minecraft and click on Options, then Resource Packs. Select your pack to load it.
  3. Load/create a world save that contains Cobblemon.
  4. Once in the world, you can run the command /pokespawn <target pokemon>.
  5. Ensure your new animations are working properly.
  6. Make any desired edits to the animation files and save. Refresh resource packs with F3+T to see the changes you make.

Your new animations, as well as any unedited ones, should now be working on the official model!