Package mcp.mobius.waila.api.component
Class TextureComponent
java.lang.Object
mcp.mobius.waila.api.component.TextureComponent
- All Implemented Interfaces:
ITooltipComponent
Component that renders a texture.
-
Nested Class Summary
Nested classes/interfaces inherited from interface mcp.mobius.waila.api.ITooltipComponent
ITooltipComponent.HorizontalGrowing
-
Constructor Summary
ConstructorDescriptionTextureComponent
(ResourceLocation textureId, int u, int v, int width, int height) Note: the texture must be 256x256 px, use other constructor if you have different sized texture.TextureComponent
(ResourceLocation textureId, int u, int v, int width, int height, int textureWidth, int textureHeight) TextureComponent
(ResourceLocation textureId, int width, int height, int u, int v, int regionWidth, int regionHeight, int textureWidth, int textureHeight) -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the height of the component.int
getWidth()
Returns the width of the component.void
render
(GuiGraphics ctx, int x, int y, DeltaTracker delta) Renders the component.
-
Constructor Details
-
TextureComponent
Note: the texture must be 256x256 px, use other constructor if you have different sized texture.- Parameters:
textureId
- the id of the textureu
- the left-most coordinate of the texture regionv
- the top-most coordinate of the texture regionwidth
- the width of the rectangleheight
- the height of the rectangle
-
TextureComponent
public TextureComponent(ResourceLocation textureId, int u, int v, int width, int height, int textureWidth, int textureHeight) - Parameters:
textureId
- the id of the textureu
- the left-most coordinate of the texture regionv
- the top-most coordinate of the texture regionwidth
- the width of the rectangleheight
- the height of the rectangletextureWidth
- the width of the entire texturetextureHeight
- the height of the entire texture
-
TextureComponent
public TextureComponent(ResourceLocation textureId, int width, int height, int u, int v, int regionWidth, int regionHeight, int textureWidth, int textureHeight) - Parameters:
textureId
- the id of the texturewidth
- the width of the rectangleheight
- the height of the rectangleu
- the left-most coordinate of the texture regionv
- the top-most coordinate of the texture regionregionWidth
- the width of the texture regionregionHeight
- the height of the texture regiontextureWidth
- the width of the entire texturetextureHeight
- the height of the entire texture
-
-
Method Details
-
getWidth
public int getWidth()Description copied from interface:ITooltipComponent
Returns the width of the component.Contract:
ITooltipComponent.getWidth()
will be called first, thenITooltipComponent.getHeight()
.- Specified by:
getWidth
in interfaceITooltipComponent
-
getHeight
public int getHeight()Description copied from interface:ITooltipComponent
Returns the height of the component.Contract:
ITooltipComponent.getWidth()
will be called first, thenITooltipComponent.getHeight()
.- Specified by:
getHeight
in interfaceITooltipComponent
-
render
Description copied from interface:ITooltipComponent
Renders the component.- Specified by:
render
in interfaceITooltipComponent
-