Skip to content

Creating Animation Config

LopyMine edited this page Sep 22, 2024 · 5 revisions

Now we need to create a config file for our animation. It can be only .json and .json5. You can put this file in any subfolder of the assets/patpat/ folder.

  1. First, let's find out what options exist:

— Main Options —

version status

Version: 1.0.0 | Type: String | Example: 1.5.2

Indicates a version of the config file. This is necessary so that in the future the mod can process old config options. Specify a string with three numbers separated by a dot without spaces.


priority status

Version: 1.0.0 | Type: Integer | Example: 10 | Default Value: 0

Indicates priority of custom animation. Specify a number from -2147483648 to 2147483647.

Try to avoid MIN and MAX values, range [-10000, 10000] is more than enough!

How Priority Works?

Each custom animation has its own priority. When someone interacts with an entity, the first custom animation will be used that meets three criteria:

  • Entity Type
  • Entity Name
  • Entity UUID

If there are some custom animations that meet the criteria, then the order is adjusted as follows:

  • If custom animations are in different resource packs, then will be used custom animation from the highest resource pack.
  • If custom animations are in the same resource pack, then will be used custom animation with the higher priority.
  • If the priority is the same, then it's sorted based on the file path.

animation status

Version: 1.0.0 | See "About "animation" Object"

Contains animation settings, like duration, sounds, etc.


blacklist status

Version: 1.0.0 | Type: Boolean | Example: false or true | Default Value: false

Switch entities list to whitelist[false] mode, or blacklist[true].

  • If true, then the list will work like a blacklist. Will be accepted all entities, except entities from entities list
  • If false, then the list will work like a whitelist. Will be accepted only entities from entities list

entities status

Version: 1.0.0 | See "About "entity" Object"

Contains entities on which this animation will play. You can set it to all to select all entities.

— About "animation" Object —

texture status

Version: 1.0.0 | Type: String | Example: patpat:textres/path/to/texture.png

Contains a path to texture that will be used on playing animation.

All animation textures should be in 'textures/' folder, because mod will search texture in this folder!


duration status

Version: 1.0.0 | Type: Integer | Example: 300

Indicates animation duration in ms. Cannot be negative.


frame status

Version: 1.0.0 | See "About "frame" Object"

Contains frame settings, like total frames count, offsets, scaling, etc.


sound status

Version: 1.0.0 | See "About "sound" Object"

Indicates a sound that will be played with animation, and optionally sound min/max pitch and volume.

— About "frame" Object —

totalFrames status

Version: 1.0.0 | Type: Integer | Example: 5

Indicates total frames at your texture.


scaleX status

Version: 1.0.0 | Type: Double | Example: 1.5 | Default Value: 0.9

Indicates texture scaling by X axis. For example, if the value is 2.0, then the texture will be two times larger.


scaleY status

Version: 1.0.0 | Type: Double | Example: 1.5 | Default Value: 0.9

Indicates texture scaling by Y axis. For example, if the value is 2.0, then the texture will be two times larger.


offsetX status

Version: 1.0.0 | Type: Double | Example: -1.5 | Default Value: 0.0

Indicates texture offset by X axis.


offsetY status

Version: 1.0.0 | Type: Double | Example: 1.5 | Default Value: 0.0

Indicates texture offset by Y axis.


offsetZ status

Version: 1.0.0 | Type: Double | Example: -1.5 | Default Value: 0.0

Indicates texture offset by Z axis.

— About 'sound' Object —

id status

Version: 1.0.0 | Type: String | Example: patpat:pat_sound

Indicates sound id.


minPitch status

Version: 1.0.0 | Type: Double | Example: 1.5 | Default Value: 1.0

Indicates min value of sound pitch.


maxPitch status

Version: 1.0.0 | Type: Double | Example: 1.5 | Default Value: 1.0

Indicates max value of sound pitch.


volume status

Version: 1.0.0 | Type: Double | Example: 1.5 | Default Value: 1.0

Indicates volume of sound.

— About 'entity' Object —

id status

Version: 1.0.0 | Type: String | Example: minecraft:pig

Indicates an entity type. If not present, PatPat mod will pass comparing this option.


name status

Version: 1.0.0 | Type: String | Example: My Cute Dog

Indicates an entity name. Entity name means entity name, not entity type name. For example, I named my dog to My Cute Dog and I want to use my animation only for entities, which has this name, then I should write here My Cute Dog.


uuid status

Version: 1.0.0 | Type: String | Example: 192e3748-12d5-4573-a8a5-479cd394a1dc

Indicates entity UUID. Usually you will use it to specify your animation on a specific player, which has its own unique UUID. For example, I want to use my animation only at player LopyMine, I will write here his UUID: 192e3748-12d5-4573-a8a5-479cd394a1dc.

from status

Version: 1.0.0 | See "About "from" Object"

Indicates entity UUID. Usually you will use it to specify your animation on a specific player, which has its own unique UUID. For example, I want to use my animation only at player LopyMine, I will write here his UUID: 192e3748-12d5-4573-a8a5-479cd394a1dc.

— About 'from' Object —

name status

Version: 1.0.0 | Type: String | Example: nikita51

Indicates a player name, which can use your animation. For example, you want an animation that will only work if you pat someone, then you will need to write your nickname here.


uuid status

Version: 1.0.0 | Type: String | Example: 192e3748-12d5-4573-a8a5-479cd394a1dc

Indicates player UUID. For example, you want an animation that will only work if you pat someone, then you will need to write your uuid here.

Example of Custom Animation Config

PatPat Mod has own example of Custom Animation Config with all options, you can look at it here.

Creating Own Custom Animation Config

Well, now we know what options exist.

  1. Let's try to create our own simple config file based on this example:

animated_piston.json5

{
	"version": "1.0.0",
	"animation": {
		"texture": "patpat:textures/animated_piston_texture.png",
		"duration": 300,
		"frame": {
			"totalFrames": 5,
			"scaleX": 1,
			"scaleY": 1,
			"offsetX": 0,
			"offsetY": 0,
			"offsetZ": 0
		}
	},
	"entities": [
		"minecraft:zombie"
	]
}
  1. Let's save it in the same directory where we saved the texture:
showcase
  1. Let's try to load our resource pack in game and pat zombie

showcase

  1. How we can see it works, but we don't hear any sounds because we forgot to add custom sound for our animation. Let's do it:

Previous Next