Clone wiki

mcpatcher / Dial_Animations

Custom Dial Animations

Vanilla Minecraft lets you create custom clock and compass textures as a strip
of vertical frames, one for each possible orientation of the clock hands or
compass needle. While this offers a lot of flexibility, it is inefficient for
producing smooth animations at higher resolutions.

MCPatcher offers an alternate method suitable for creating smoother-looking
analog dial animations. Using this method not prevent you from also providing
a vanilla compass or clock animation in your texture pack, and in fact you
should provide one as a fallback for non-MCPatcher users if possible.

Each dial animation is specified as a series of texture layers. Some layers
can be fixed, others can rotate based on the direction to spawn (compass) or
time of day (clock). Layers are rendered one on top of another using blending
methods you specify.

Properties file format (Template)

Create a properties file for the animation you wish to customize:

  • Clock: assets/minecraft/mcpatcher/dial/clock.properties
  • Compass: assets/minecraft/mcpatcher/dial/compass.properties

(Required) Source texture

source.0=<texture>

The texture for this layer. See
About Properties Files for how to specify paths to
texture files.

The first (bottommost) layer is source.0. Subsequent layers use source.1,
source.2, etc.

Bilinear filtering can be enabled for any layer using a lesser-known vanilla
trick. Create an mcmeta file in the same directory as the source texture and
add the following bit of JSON code:

{
  "texture": {
    "blur": true,
    "clamp": false
  }
}

(Optional) Layer scaling

scaleX.0=1.0
scaleY.0=1.0

Expand or shrink the texture along the x- or y-axis. The default is no scaling
(1.0 in both directions).

(Optional) Layer offset

offsetX.0=0.0
offsetY.0=0.0

Offset the texture by a fixed amount. Use the range -1 .. 1. The default is
0.0 in both directions.

(Optional) Blend method

blend.0=<method>

Specifies how to combine this layer with the previous ones. See
About Properties Files for a list of recognized
blending methods. The default is alpha blending.

(Optional) Rotation

rotationSpeed.0=0.0
rotationOffset.0=0.0

Multiplier and offset applied to the angle before rendering. For the compass,
this always points away from spawn. For the clock, the angle is the time of
day: 0 = midnight 90 = 6am, 180 = noon, 270 = 6pm.

The formula used is

displayed angle = rotationSpeed * original angle + rotationOffset

Generally, rotationSpeed is either 0 (for fixed layers such as a clock base) or
1 (for the needle/dial), but other values can be used to create things like
hour and minute hands. Negative values cause the texture to rotate backwards.
Non-integer values will likely produce strange behavior.

The simplest case, a compass with a fixed base and a rotating needle, looks
like

source.0=compass_base.png
source.1=compass_dial.png
scaleY.1=0.5
rotationSpeed.1=1

The scaleY=0.5 property gives it the appearance of tilting into the screen.

Due to a quirk in the game's code, the compass needle actually points away
from spawn. So compass_dial.png should have the needle pointing south (down).
If it is pointing up, either flip it in an image editor or, equivalently, add a
rotationOffset property:

rotationOffset.1=180

Additional properties

Converting your custom dial animation to vanilla format

outputFrames=<number of animation frames>

NOTE: DO NOT DISTRIBUTE YOUR TEXTURE PACK WITH THIS PROPERTY SET!

Add this property to quickly generate a default vanilla-style animation strip,
which you can use as a fallback for players without custom compass/clock
support.

When the game starts up, a series of frames 360/n degrees apart will be
rendered into an animation at custom_{compass,clock}.png in your .minecraft
folder. Open the file in an image editor, and once you are satisfied with it,
move it to assets/minecraft/textures/items/{compass,clock}.png in your texture
pack.

Updated