Texture Info
Added: 1.0.0
An interface representing textures. It is designed to make it easier to draw textures anywhere on the screen.
Use the static factory method create() to instantiate a new definition.
Methods
| Return Type | Signature |
|---|---|
TextureInfo | static create(@NotNull ResourceLocation texture, @Nullable Rectangle region) |
ResourceLocation | getTexture() |
int | getAtlasWidth() |
int | getAtlasHeight() |
int | getWidth() |
int | getHeight() |
| TextureUV | getUV() |
boolean | isPixelSolid(int x, int y) |
void | render(PoseStack poseStack, int x, int y, Color color) |
create
Added: 1.0.0
Static factory method that instantiates a new instance pointing to a resource location and a region for cropping a sub-texture.
- Texture: The resource location to the texture file.
- Region: The region defining the cropped sub-texture. Pass
nullto use the whole texture.
getTexture
Added: 1.0.0
Returns the ResourceLocation identifier pointing to the texture file.
getAtlasWidth
Added: 1.0.0
Returns the width of the entire texture.
getAtlasHeight
Added: 1.0.0
Returns the height of the entire texture.
getWidth
Added: 1.0.0
Returns the width of the cropped sub-texture. Same as getAtlasWidth() if region was null.
getHeight
Added: 1.0.0
Returns the height of the cropped sub-texture. Same as getAtlasHeight() if region was null.
getUV
Added: 1.0.0
Returns the TextureUV object that is used by the rendering methods.
isPixelSolid
Added: 1.0.0
Returns true if the pixel at the given local coordinates is solid (opaque).
The first time
isPixelSolid()is called, it calculates and caches a bit mask to speed up consecutive checks.
render
Added: 1.0.0
Renders the texture onto the screen at the specified coordinates.
- poseStack: The pose stack.
- x: The GUI scaled screen X coordinate to be used as the left-most coordinate.
- y: The GUI scaled screen Y coordinate to be used as the top-most coordinate.
- color: The Color to tint the texture. Pass white for normal rendering.