Random Entities

File location

/assets/minecraft/optifine/random/**/*.png /assets/minecraft/optifine/random/**/*.properties

_images/icon18.webp

Rabbits can be frogs.

Random Entities changes an entity's texture based on its qualities, such as position, NBT rules, the time, and more.

_images/settings11.webp

Button and tooltip for the option, found in Video Settings ‣ Quality.

_images/piglin.webp

Random entities applied to a Piglin

Vanilla textures are assigned a texture number of 1.

Files

This file can be placed in the optifine/random/ folder of the resource pack, parallel to the vanilla texture in textures/:

  • /assets/minecraft/textures/entity/creeper/creeper.png

  • /assets/minecraft/optifine/random/entity/creeper/creeper2.png

  • /assets/minecraft/optifine/random/entity/creeper/creeper3.png

  • /assets/minecraft/optifine/random/entity/creeper/creeper4.png

  • etc.

  • /assets/minecraft/optifine/random/entity/creeper/creeper.properties

Textures ending with a digit use the separator ..

  • /assets/minecraft/textures/entity/warden/warden_pulsating_spots_2.png

  • /assets/minecraft/optifine/random/entity/warden/warden_pulsating_spots_2.2.png

  • /assets/minecraft/optifine/random/entity/warden/warden_pulsating_spots_2.3.png

  • /assets/minecraft/optifine/random/entity/warden/warden_pulsating_spots_2.4.png

  • /assets/minecraft/optifine/random/entity/warden/warden_pulsating_spots_2.properties

The textures and configurations in /assets/minecraft/optifine/mob/ are also supported.

Matching order

Each rule specifies a range of entity textures to use and one or more conditions under which to use them.

The entity coordinates when it spawns (single player) or when it is first seen by the client (multiplayer) are checked against each rule in sequence.

The first rule that matches wins. If no rule matches, the default texture (e.g., creeper.png) is used.

If no .properties file is present for an entity, then all available textures are used for that type of entity.

Entities with multiple textures will use the .properties file for the base texture.

In other words, all of these do not need to be created explicitly:

  • wolf.properties

  • wolf_tame.properties

  • wolf_angry.properties

Just wolf.properties will work for all three, provided there are the same number of textures for each. Similarly for "_eyes" and "_overlay".

Properties

Important

N starts at 1. Do not skip numbers; n=1 n=2 n=5 in sequence is invalid.

Important

For all of these, N is a number that links the individual properties together to form a rule.

textures.N

Values: List of texture indices
Required

List of entity textures to use.

The texture index 1 is the default texture from /assets/minecraft/texture. Alternatively, the legacy property skins.N can be used.

skins.N

Values: See textures.N
Optional

weights.N

Values: List of integers
Optional
Default: None

List of weights to apply to the random choice.

Important

Weights do not have to total 100, or any other particular value. The number of weights should match the number of textures.

biomes.N

Values: List of strings
Optional
Default: None

List of biomes.

The vanilla biome names are listed here. Biomes added by mods can also be used.

heights.N

Values: Range of integers
Optional

Height ranges.

Replaces legacy minHeight and maxHeight properties. Since 1.18, negative values may be specified for height. When used in a range they have to be put in parenthesis ( ): (-3)-64.

name.N

Values: String
Optional

Entity name.

Uses the Strings syntax.

professions.N

Values: List of strings: none, armorer, butcher, cartographer, cleric, farmer, fisherman, fletcher, leatherworker, librarian, mason, nitwit, shepherd, toolsmith, and weaponsmith, along with an optional level experience format
Optional

List of villager professions with optional levels.

Entry format: <profession>[:level1,level2,...].

Example:

  • Professions farmer (all levels) or librarian (levels 1,3,4): professions=farmer librarian:1,3-4.

  • Professions fisher, shepard, nitwit: professions=fisherman shepherd nitwit.

colors.N

Values: List of strings: white, orange, magenta, light_blue, yellow, lime, pink, gray, light_gray, cyan, purple, blue, brown, green, red, and black
Optional

List of wolf/cat collar colors or sheep/llama/shulker box/bed colors.

Example: colors.2=pink magenta purple.

The legacy property collarColors is also recognized.

New in version I1: Bed color detection

New in version I3: Shulker box color detection

baby.N

Values: Boolean
Optional

If entity is a baby. Only valid for mobs.

health.N

Values: List of integers or integer Range, percents
Optional

Range of health values; can also be given in percent. Only valid for mobs.

Example:

health.1=10
health.2=5-8 10-12
health.3=0-50%

moonPhase.N

Values: List of integers or integer Range
Optional

List of moon phases, from 0 to 7.

Example:

moonPhase.1=3
moonPhase.2=0 1 2
moonPhase.1=0-2 4-7

dayTime.N

Values: List of integers or integer Range
Optional
Default: None

List of day times in ticks (0-24000)

Example:

dayTime.1=2000-10000
dayTime.2=0-1000 18000-24000

weather.N

Values: List of strings: clear, rain, and thunder
Optional

Weather conditions.

sizes.N

Values: List of integers or integer Range
Optional

New in version H7.

Size of entity, if applicable.

Slimes and magma cubes naturally spawn in three sizes: 0=small, 1=medium, 3=big. Naturally spawning phantoms only spawn in one size, 0.

Important

This is only valid for mobs with multiple sizes (0-255 for slimes and magma cubes, and 0-64 for phantoms).

Example:

textures.1=3
textures.2=0 1 3
textures.3=0-2 4-7

nbt.N.TAG

Optional
Default: None

NBT-based rule.

Important

See Client-side data.

blocks.N

Values: Block
Optional
Default: None

For entities, this checks the block on which the entity is standing. For block entities, this checks the block of the block entity.

Examples

Creeper

Uses creeper10.png through creeper14.png for all underground creepers. creeper13.png will be used 7.3% (3/(10+10+10+3+10)) of the time.

textures.1=10-14
weights.1=10 10 10 3 10
heights.1=0-55

# Use 5, 7, 9 in high, hilly areas.
textures.2=5 7 9
biomes.2=windswept_hills desert forest badlands jagged_peaks stony_peaks
heights.2=80-255

# Fallback rule if nothing else matches.
# Remember that if no rule matches, only the base creeper/creeper.png will be used.
textures.3=1-4 6 8 15-20

Omit Vanilla texture

Uses slime2.png through slime16.png for all slimes, not including the vanilla texture.

textures.1=2-16

JSON schema

Note

Although this page is .properties based, it can be mapped to JSON.

{
	"$schema": "http://json-schema.org/draft/2020-12/schema",
	"$id": "https://gitlab.com/whoatemybutter/optifinedocs/-/blob/master/schemas/random_entities.schema.json",
	"title": "Random Entities",
	"description": "Random Entities changes an entity's texture based on its qualities, such as position, NBT rules, the day time, and more..",
	"type": "object",
	"patternProperties": {
		"^textures\\.\\d+$": {
			"type": "string",
			"description": "Space-separated string of entity textures to use."
		},
		"^skins\\.\\d+$": {
			"type": "string",
			"description": "Legacy property of textures.N."
		},
		"^weights\\.\\d+$": {
			"type": "string",
			"description": "Space-separated string of weights to apply to the random choice."
		},
		"^biomes\\.\\d+$": {
			"type": "string",
			"description": "Space-separated string of biomes."
		},
		"^heights\\.\\d+$": {
			"type": "string",
			"description": "Height ranges."
		},
		"^name\\.\\d+$": {
			"type": "string",
			"description": "Entity name to match."
		},
		"^professions\\.\\d+$": {
			"pattern": "(none|armorer|butcher|cartographer|cleric|farmer|fisherman|fletcher|leatherworker|librarian|mason|nitwit|shepherd|toolsmith|weaponsmith)(:\\d+(-\\d+)?(,\\d+(-\\d+)?)*)",
			"description": "Space-separated string of villager professions with an optional level specifier."
		},
		"^colors\\.\\d+$": {
			"type": "string",
			"pattern": "(white|orange|magenta|light_blue|yellow|lime|pink|gray|light_gray|cyan|purple|blue|brown|green|red|black) ?",
			"description": "Space-separated string of wolf/cat collar colors or sheep/llama/shulker box/bed colors."
		},
		"^baby\\.\\d+$": {
			"type": "boolean",
			"description": "If entity is a baby."
		},
		"^health\\.\\d+$": {
			"type": "string",
			"description": "Range of health values; can also be given in percent."
		},
		"^moonPhase\\.\\d+$": {
			"type": "string",
			"description": "List of moon phases, from 0 to 7."
		},
		"^dayTime\\.\\d+$": {
			"type": "string",
			"description": "List of day times in ticks, from 0 to 24000."
		},
		"^weather\\.\\d+$": {
			"type": "string",
			"pattern": "(clear|rain|thunder) ?",
			"description": "Weather conditions."
		},
		"^sizes\\.\\d+$": {
			"type": "string",
			"description": "Size of mob, if applicable"
		},
		"^nbt\\.([a-zA-Z0-9_\\-.+]+|\".*?\")$": {
			"type": [
				"number",
				"string"
			],
			"description": "NBT-based rule."
		},
		"^blocks\\.\\d+$": {
			"$ref": "common.schema.json#/$defs/item_id_list",
			"description": "What block the entity is standing on, or what block the entity is."
		}
	},
	"additionalProperties": false
}

Assumes the latest OptiFine version.
Updated to commit feb2a450.

Last update: 2024 January 31