Tutorials/Animation Replacement: Difference between revisions

m (added back Category:Tutorial)
(Under Construction quick save)
Line 1: Line 1:
{{TOC|right}}
{{TOC|right}}
== Preface ==
== 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.
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 [[Tutorials/Creating_A_Custom_Pokemon|creating custom Pokémon]] is highly recommended.


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


=== Step 4: Create a new poser file ===
=== 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.  
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.  


# Create a new poser JSON for your Pokémon.
# Create a new poser JSON for your Pokémon.
#* You can reference the [[Poser]] Wiki page for details on every property of this JSON.
#* The Poser Wiki page also contains an [[Poser#Poser_File_Example|example which you can use as a template]] for this step. You can remove poses which are not needed for your animations.
# Be sure to assign all animations and quirks that you just exported!
# Be sure to assign all animations and quirks that you just exported!
# Make sure the assigned animations match the name scheme in the animation file!
# Save the file.
# Save the file.
# Name this new poser file <code><pokemon>.json</code> and save it somewhere.
# Name this new poser file <code><pokemon>.json</code> and save it somewhere.
# Ensure that the file extension for this poser file is JSON and not anything else (such as TXT).
# Ensure that the file extension for this poser file is JSON and not anything else (such as TXT).


If you are unsure of how to write the poser file, you can reference the poser section of the [https://cobblemon.com/guides/custompokemon#posers 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 [https://gitlab.com/cable-mc/cobblemon/-/tree/main/common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon 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!
If you are very familiar with poser files, you can reference the kotlin model files found on the [https://gitlab.com/cable-mc/cobblemon/-/tree/main/common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon 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 ===
=== 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 Pokémon 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.  
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 Pokémon 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.  


# Open the acquired resolver file in your preferred text editor.
# Open the acquired resolver file in your preferred text editor.
# Locate the string for <code>"order"</code>.
# Locate the string for <code>"order"</code>.
# Change the value of "order" from 0 to 1.
# Change the value of "order" from 0 to 1.
#* In some cases, this value may have to be higher. This is the case for Pokémon that have some regional forms, gender differences, or similar.
# Locate any lines in the json with the string for <code>"model"</code>.
# Locate any lines in the json with the string for <code>"model"</code>.
#* In the case of editing the Pokémon with special forms, as mentioned earlier, you might have to include new variations to replace the models of these forms if applicable.
# Change the designated model to your clone.</br> example:</br><code>"model": "cobblemon:charmander.geo"</code> > <code>"model": "cobblemon:charmander2.geo"</code>
# Change the designated model to your clone.</br> example:</br><code>"model": "cobblemon:charmander.geo"</code> > <code>"model": "cobblemon:charmander2.geo"</code>
# Save the file.
# Save the file.

Revision as of 01:07, 27 February 2024

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 Pokémon'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 Pokémon.
  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 Pokémon 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 Pokémon.
    • You can reference the Poser Wiki page for details on every property of this JSON.
    • The Poser Wiki page also contains an example which you can use as a template for this step. You can remove poses which are not needed for your animations.
  2. Be sure to assign all animations and quirks that you just exported!
  3. Save the file.
  4. Name this new poser file <pokemon>.json and save it somewhere.
  5. Ensure that the file extension for this poser file is JSON and not anything else (such as TXT).


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 Pokémon 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.
    • In some cases, this value may have to be higher. This is the case for Pokémon that have some regional forms, gender differences, or similar.
  4. Locate any lines in the json with the string for "model".
    • In the case of editing the Pokémon with special forms, as mentioned earlier, you might have to include new variations to replace the models of these forms if applicable.
  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 Pokémon 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 Pokémon's national Pokédex 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 replaced. 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!