Skip to content

VanillaSpriteTexture

Since 2.2.1

VanillaSpriteTexture renders a sprite that is already registered in Minecraft's vanilla GUI atlas. Use it when you want to draw a vanilla UI sprite such as the recipe-book toast icon or other atlas-backed GUI parts.

Unlike SpriteTexture, this texture does not load a PNG file from your mod's assets/ directory. The sprite value must be the identifier of a sprite available in the vanilla GUI atlas.

Sprite identifiers follow Minecraft's blitSprite convention: they are relative to textures/gui/sprites and do not include the file extension. For example, minecraft:toast/recipe_book points to assets/minecraft/textures/gui/sprites/toast/recipe_book.png. To register and configure GUI sprites, see the NeoForge Screens texture documentation.

Registry name: vanilla_sprite_texture

Extends TransformTexture - supports rotate(), scale(), transform(), and color tinting.

Use SpriteTexture for your own image files. Use VanillaSpriteTexture when the image is provided by Minecraft's GUI atlas.


Usage

IGuiTexture toastIcon = VanillaSpriteTexture.of("minecraft:toast/recipe_book");

IGuiTexture tinted = VanillaSpriteTexture.of("minecraft:toast/recipe_book")
    .setColor(0xFFFFAA44);
val toastIcon = VanillaSpriteTexture.of("minecraft:toast/recipe_book")

val tinted = VanillaSpriteTexture.of("minecraft:toast/recipe_book")
    .setColor(0xFFFFAA44.toInt())
let toastIcon = VanillaSpriteTexture.of("minecraft:toast/recipe_book");

let tinted = VanillaSpriteTexture.of("minecraft:toast/recipe_book")
    .setColor(0xFFFFAA44);

LSS

/* Vanilla GUI atlas sprite */
background: vanilla-sprite(minecraft:toast/recipe_book);

/* With transform chain */
background: vanilla-sprite(minecraft:toast/recipe_book) scale(0.8) rotate(15);

/* With color tint */
background: vanilla-sprite(minecraft:toast/recipe_book) color(#FFFFAA44);

Fields

Name Type Description
sprite Identifier Identifier of the sprite in Minecraft's GUI atlas. Default: minecraft:toast/recipe_book.
color int ARGB color tint. Default: 0xFFFFFFFF (no tint).

Methods

Method Returns Description
VanillaSpriteTexture.of(String) VanillaSpriteTexture Static factory from a resource-location string.
VanillaSpriteTexture.of(Identifier) VanillaSpriteTexture Static factory from an Identifier.
setSprite(Identifier) VanillaSpriteTexture Changes the vanilla GUI atlas sprite.
setColor(int) VanillaSpriteTexture Sets the ARGB tint color.
copy() VanillaSpriteTexture Returns a deep copy.