Skip to content

ResourceTexture ​

The ResourceTexture class extends TransformTexture to render textures based on a resource location. It supports configurable offsets, dimensions, and color overlays.

Basic Properties ​

FieldDescription
imageLocationThe resource location of the texture image
offsetXHorizontal offset of the texture (default is 0)
offsetYVertical offset of the texture (default is 0)
imageWidthWidth factor of the texture (default is 1)
imageHeightHeight factor of the texture (default is 1)
colorColor overlay applied to the texture (default is -1)

APIs ​

createTexture ​

Create a texture from a resource location.

java
// Using float parameters
var texture = new ResourceTexture("ldlib:textures/gui/icon.png");

getSubTexture ​

Returns a sub-texture of the current texture.

java
// Using float parameters
var subTexture = resourceTexture.getSubTexture(0.2, 0.2, 0.5, 0.5);

Released under the MIT License.