Custom Item Textures¶
The amount changes the texture.¶
Custom Item Textures (CIT) can change items to different textures based on their properties, such as enchantments, names, and NBT rules.
Global properties¶
File location
/assets/minecraft/optifine/cit.properties
This file contains global properties for CIT and should be in the optifine/cit folder of the resource pack.
For individual item textures, see the Properties section.
Note
average and layered methods with cap=1 are equivalent and will both show only the first enchantment on an item.
Danger
Not implemented: method, cap, fade.
- method¶
Specifies how to apply multiple effects to the same item. Depending on the method chosen, multiple effects can be rendered with different intensities from
0(invisible) to1(fully visible).average: Weighted average by enchantment level:intensity = enchantment_level / sum(enchantment_levels).layered: Similar toaverage, butmax()is used instead ofsum():intensity = enchantment_level / max(enchantment_levels).cycle: Cycle through each effect in turn. The duration of each effect can be set via thedurationproperty. The[group]value (if present) allows multiple sets of effects to be cycled through independently.
- cap¶
Specifies how many layers can be rendered for
averageandlayeredmethods. The top-most layers have priority over the bottom-most layers, as determined by the layer value of each effect.
- fade¶
The speed at which one effect will transition into another in a cycle. This does not affect the duration of the actual effect when displayed. For that, use the effect's
durationproperty.
- useGlint¶
Whether to use the default
glint.pngenchantment texture or not.If true:
glint.pngis used if no other custom enchantment effect is available.If false: the default
glint.pngenchantment stops rendering completely.
This is important for items that have no specific enchantment but have an enchantment effect, such as potions and golden apples.
Danger
This has been broken since 1.12. See GH-6480.
Properties¶
File location
/assets/minecraft/optifine/cit/**/*.properties
For each item to override with a custom texture, create a .properties file in the /assets/minecraft/optifine/cit/ folder of the resource pack.
Properties files can be organized into subfolders of any depth, as long as everything is within the top-level optifine/cit folder.
Each properties file specifies:
A list of matching items.
A replacement texture or model.
An optional set of rules specifying when this CIT will apply to the item.
Note
\u0107 instead of ć.- type¶
Type of texture replacement.
Simple item texture replacement. It applies to items in the GUI, held in hand, and in the world. If multiple CIT rules match the same item, only the first is used (sorted by weight, then by file name).
Overlay texture for enchantments (replaces
misc/glint.png). If multiple CIT rules match the same item, they are blended together using rules specified in Global properties.Danger
Past 1.12, this no longer works.
Armor texture replacement. Applies to armor models worn by players and mobs. If multiple CIT rules match the same item, only the first (sorted by weight, then by file name) is used.
Elytra texture replacement. Applies to elytra model worn by players and mobs. If multiple CIT rules match the same item, only the first (sorted by weight, then by file name) is used.
- items¶
What items to apply the CIT to. If more than 1 item is specified, the CIT will apply to any item in the list.
- texture¶
Path to the replacement texture.
It can be a full path or a lone name:
mytextures/excalibur.png⇒mytextures/excalibur.pngexcalibur⇒optifine/cit/excalibur.png
- model¶
Path to the replacement model. The model must be in vanilla format.
item/mymodel→/assets/minecraft/models/item/mymodel.json./mymodel→mymodel.jsonfrom the same folder as the properties file
Note
The model may reference textures from the same folder as where the originating CIT file is.
- damage¶
Damage values. CIT will apply only when the item damage is a certain value or range.
For items with durability, damage starts at 0 for a new item and increases as it gets damaged. A brand-new item's damage will always be 0. The maximum damage an item can take varies
For 1.12 and below,
damagerepresents different properties like potion type. See this page for specifics.
- damageMask¶
A bitmask applied to the item's damage before checking it against the list of eligible damage values.
Examples:
Match any Fire Resistance potion:
damage=3 damageMask=15Match any non-splash Fire Resistance potion:
damage=3 damageMask=16399Match non-splash Fire Resistance I potion only:
damage=3 damageMask=16447Match splash Fire Resistance II potion only:
damage=16403 damageMask=16447
Note
For a simpler way, see Potions.
Danger
This is an extremely unreliable and largely-unused method of checking properties. Do not use it.
- stackSize¶
The required amount(s) of item that must be in an inventory slot.
Although the maximum legitimate amount is 64, values up to 65535 are allowed.
Note
Values above 64 are useless.
- enchantments¶
List of enchantment names to match.
The enchantment names may be short (
flame) or in full (minecraft:flame). For example:enchantments=minecraft:silk_touch sharpness smite.Note
If the
enchantmentLevelsrule is not specified, this rule matches any enchantment level.
- enchantmentIDs¶
Legacy
Legacy alias to
enchantments.
- enchantmentLevels¶
List of enchantment levels.
For example:
enchantmentLevels=1 3 5 10, orenchantmentLevels=5-.Note
If
enchantmentsis not specified, this rule matches any enchantment type.
- hand¶
Hand on which the item is placed onto: main hand or off-hand.
When rendered in the inventory GUI, the item is considered to be in the
mainhand.
CIT can apply conditionally if you're holding the item in the left or right hand.¶
Type-specific properties¶
Items¶
Note
Implies type=item.
- texture.<name>¶
Replacement for alternate textures.
For items with more than one texture, this allows specifying replacements for each texture separately. These textures depend on the item's model.
For example, the bow has four possible textures depending on its state:
bow_standby,bow_pulling_0,bow_pulling_1, orbow_pulling_2.To replace all four, this can be used:
texture.bow_standby=my_special_bow_standby texture.bow_pulling_0=my_special_bow_pulling_0 texture.bow_pulling_1=my_special_bow_pulling_1 texture.bow_pulling_2=my_special_bow_pulling_2Potions also have two textures. To replace them, use:
texture.potion_overlay=... texture.potion_bottle=...Note
If no
texture.<name>property matches, the generictextureproperty is used instead.
- model.<name>¶
Replacement for alternate models.
For items with more than one model, this allows specifying replacements for each model separately.
For example, the bow has four possible textures depending on its state:
bow_standby,bow_pulling_0,bow_pulling_1,bow_pulling_2. To replace all four, this can be used:model.bow_standby=my_special_bow_standby model.bow_pulling_0=my_special_bow_pulling_0 model.bow_pulling_1=my_special_bow_pulling_1 model.bow_pulling_2=my_special_bow_pulling_2
- weight¶
If multiple CIT rules match the same item, the highest-weighted one is used (the biggest number). In the event of a tie, the properties filenames are compared alphabetically.
Enchantments¶
Note
Implies type=enchantment.
Note
duration only works for cycle enchantments.
Danger
Past 1.12, this no longer works.
- texture¶
The enchantment texture can be any resolution.
To animate an enchantment, use the
anim/*.propertiesmethod withto=full path to enchantment texture
- blend¶
Blend method when applying texture to the texture below it.
Danger
This has been broken. See GH-5304.
- speed¶
Scrolling speed of texture.
0means no scrolling.
- rotation¶
Angle of texture (in degrees) relative to the item.
If
speedis non-zero, the texture will also scroll in this direction.
- layer¶
Specifies a unique layer and the ordering of the layers as they overlap each other.
If two or more effects use the same layer,
weightnext determines which effect is rendered (the other is not rendered).
- weight¶
The relative priority of the enchantment within a layer.
Of the matching effects, only the highest weighted one within a layer is rendered. In other words:
The layer property determines the ORDER in which effects are rendered.
The weight property determines WHICH effect is rendered for each layer.
If two effects have the same weight and layer, the properties filenames are sorted and compared alphabetically.
- duration¶
Duration in seconds of the enchantment glint in a cycle.
Armor¶
Note
Implies type=armor
- texture.<name>¶
Replacement textures.
A replacement for each texture is needed in
minecraft:textures/models/armor/for that armor type.For diamond armor (2 layers total):
texture.diamond_layer_1=my_diamond_armor_1 texture.diamond_layer_2=my_diamond_armor_2For leather armor (4 layers total):
texture.leather_layer_1=my_leather_armor_1 texture.leather_layer_1_overlay=my_leather_armor_1_overlay texture.leather_layer_2=my_leather_armor_2 texture.leather_layer_2_overlay=my_leather_armor_2_overlayThe texture should match the format of the corresponding armor texture.
For animated textures, use the
anim/*.propertiesmethod withto.
Potions¶
Note
While there is no specific potion-related tag, nbt should be used.
Potions with custom effects can be matched using their NBT Potion string or with nbt.CustomPotionEffects.*.Id.
type=item
items=potion
nbt.Potion=minecraft:strength
type=item
items=potion
nbt.CustomPotionEffects.*.Id=20
Stronger versions of potions can be matched by prefixing strong_ to the Potion NBT tag match.
Longer versions of potions can be matched by prefixing long_ to the Potion NBT tag match.
Lingering and Splash potions can be matched with the same method by simply changing the items tag appropriately.
Shortcut¶
Note
Everything described here can be done via CIT properties files; this is a shortcut.
Note
No properties files are necessary for this method.
As an alternative to listing potion damage values or testing NBT, replacement textures for potions can be specified using a file name-based system.
There are three directories for potions:
optifine/cit/potion/normal: drinkable potions.optifine/cit/potion/splash: splash potions.optifine/cit/potion/linger: lingering potions.
Within any of these directories, create a PNG file with the name of the potion effect:
Note
Important
This replaces both potion.png/potion_splash.png and potion_contents.png from the standard potion rendering.
Warning
Be sure to include the colored liquid in the replacement textures. Tint is not applied.
Effect name |
File name |
|---|---|
Absorption |
|
Blindness |
|
Confusion |
|
Damage Boost |
|
Mining Fatigue |
|
Haste |
|
Fire Resistance |
|
Harming |
|
Healing |
|
Health Boost |
|
Hunger |
|
Invisibility |
|
Leaping |
|
Slowness |
|
Speed |
|
Night Vision |
|
Poison |
|
Regeneration |
|
Resistance |
|
Saturation |
|
Water Breathing |
|
Weakness |
|
Wither |
|
The names are the same as the potion. The replacement texture will automatically be used for that potion type; no properties file is required. Note that this replaces both.
Similarly, textures can be replaced for the various "no effect" potions. These have drinkable versions only, the rest are in the code and are listed here only for completeness.
Note
Effect name |
File name |
|---|---|
Artless |
|
Awkward |
|
Bland |
|
Bulky |
|
Bungling |
|
Buttered |
|
Charming |
|
Clear |
|
Cordial |
|
Dashing |
|
Debonair |
|
Elegant |
|
Fancy |
|
Flat |
|
Foul |
|
Gross |
|
Harsh |
|
Milky |
|
Mundane |
|
Odorless |
|
Potent |
|
Rank |
|
Sparkling |
|
Stinky |
|
Suave |
|
Thick |
|
Thin |
|
Uninteresting |
|
If a single texture for all "no effect" potions is preferred,
/assets/minecraft/optifine/cit/potion/normal/other.png is used as a fallback for any that do not have a specific replacement as listed above.
Two additional textures (drinkable only) can also be provided:
optifine/cit/potion/normal/water.png: water bottleoptifine/cit/potion/normal/empty.png: empty glass bottle
Examples¶
Stacked coins¶
type=item
items=iron_nugget
stackSize=61-64
texture=iron_coins_16
Splash potion¶
type=item
items=splash_potion
model=item/fire_resistance_splash
nbt.Potion=minecraft:fire_resistance
{
"parent": "item/generated",
"textures": {
"layer0": "item/fire_resistance_overlay",
"layer1": "item/fire_resistance_splash"
}
}
External links¶
Warning
These resources are not related to OptiDocs, but may provide some help.
MCStacker - for generating items that can help you test conditions.