public class MalisisIcon
extends net.minecraft.client.renderer.texture.TextureAtlasSprite
TextureAtlasSprite
to allow common operations like clipping and offset.Modifier and Type | Field and Description |
---|---|
protected java.util.Set<MalisisIcon> |
dependants
Lists of MalisisIcon depending on this one.
|
protected boolean |
flippedU
Is the icon flipped on the horizontal axis.
|
protected boolean |
flippedV
Is the icon flipped on the vertical axis.
|
protected int |
rotation
Rotation value (clockwise)
|
protected int |
sheetHeight
Height of the global texture sheet.
|
protected int |
sheetWidth
Width of the global texture sheet.
|
Constructor and Description |
---|
MalisisIcon() |
MalisisIcon(net.minecraft.util.IIcon icon) |
MalisisIcon(MalisisIcon baseIcon) |
MalisisIcon(java.lang.String name) |
MalisisIcon(java.lang.String name,
float u,
float v,
float U,
float V) |
Modifier and Type | Method and Description |
---|---|
void |
addDependant(MalisisIcon icon)
Adds a
MalisisIcon to be dependant on this one. |
MalisisIcon |
clip(float offsetXFactor,
float offsetYFactor,
float widthFactor,
float heightFactor)
Clips this
MalisisIcon . |
MalisisIcon |
clip(int offsetX,
int offsetY,
int width,
int height)
Clips this
MalisisIcon . |
MalisisIcon |
copy()
Creates a new
MalisisIcon from this MalisisIcon . |
void |
copyFrom(MalisisIcon base)
Copies the values from
base to this MalisisIcon . |
MalisisIcon |
flip(boolean horizontal,
boolean vertical)
Sets this
MalisisIcon to be flipped. |
float |
getMaxU() |
float |
getMaxV() |
float |
getMinU() |
float |
getMinV() |
int |
getRotation() |
protected void |
initIcon(MalisisIcon baseIcon,
int width,
int height,
int x,
int y,
boolean rotated)
Initializes this
MalisisIcon . |
void |
initSprite(int width,
int height,
int x,
int y,
boolean rotated)
Called when the part represented by this
MalisisIcon is stiched to the texture. |
boolean |
isFlippedU() |
boolean |
isFlippedV() |
boolean |
isRotated() |
MalisisIcon |
offset(int offsetX,
int offsetY)
Offsets this
MalisisIcon by a specified amount. |
MalisisIcon |
register(net.minecraft.client.renderer.texture.TextureMap register)
Attempts to register this
MalisisIcon to the TextureMap . |
void |
setRotation(int rotation)
Sets the rotation for this
MalisisIcon . |
void |
setSize(int width,
int height)
Sets the size in pixel of this
MalisisIcon . |
clearFramesTextureData, copyFrom, generateMipmaps, getFrameCount, getFrameTextureData, getIconHeight, getIconName, getIconWidth, getInterpolatedU, getInterpolatedV, getOriginX, getOriginY, hasAnimationMetadata, hasCustomLoader, load, loadSprite, setFramesTextureData, setIconHeight, setIconWidth, toString, updateAnimation
protected int sheetWidth
protected int sheetHeight
protected boolean flippedU
protected boolean flippedV
protected int rotation
protected java.util.Set<MalisisIcon> dependants
public MalisisIcon()
public MalisisIcon(java.lang.String name)
public MalisisIcon(MalisisIcon baseIcon)
public MalisisIcon(java.lang.String name, float u, float v, float U, float V)
public MalisisIcon(net.minecraft.util.IIcon icon)
public void addDependant(MalisisIcon icon)
MalisisIcon
to be dependant on this one. Will call initIcon(MalisisIcon, int, int, int, int, boolean)
when
stiched to the sheet.icon
- the iconpublic void setSize(int width, int height)
MalisisIcon
.width
- the widthheight
- the heightpublic float getMinU()
getMinU
in interface net.minecraft.util.IIcon
getMinU
in class net.minecraft.client.renderer.texture.TextureAtlasSprite
public float getMaxU()
getMaxU
in interface net.minecraft.util.IIcon
getMaxU
in class net.minecraft.client.renderer.texture.TextureAtlasSprite
public float getMinV()
getMinV
in interface net.minecraft.util.IIcon
getMinV
in class net.minecraft.client.renderer.texture.TextureAtlasSprite
public float getMaxV()
getMaxV
in interface net.minecraft.util.IIcon
getMaxV
in class net.minecraft.client.renderer.texture.TextureAtlasSprite
public MalisisIcon flip(boolean horizontal, boolean vertical)
MalisisIcon
to be flipped.horizontal
- whether to flip horizontallyvertical
- whether to flip verticallyMalisisIcon
public boolean isFlippedU()
MalisisIcon
is flipped horizontally.public boolean isFlippedV()
MalisisIcon
is flipped vertically.public boolean isRotated()
MalisisIcon
is rotated.public void setRotation(int rotation)
MalisisIcon
. The icon will be rotated rotation x 90 degrees clockwise.rotation
- the rotationpublic int getRotation()
MalisisIcon
.protected void initIcon(MalisisIcon baseIcon, int width, int height, int x, int y, boolean rotated)
MalisisIcon
. Called from the icon this one depends on, copying the baseIcon values.baseIcon
- the base iconwidth
- the widthheight
- the heightx
- the xy
- the yrotated
- the rotatedpublic MalisisIcon offset(int offsetX, int offsetY)
MalisisIcon
by a specified amount. offsetX and offsetY are specified in pixels.offsetX
- the x offsetoffsetY
- the y offsetMalisisIcon
public MalisisIcon clip(int offsetX, int offsetY, int width, int height)
MalisisIcon
. offsetX, offsetY, width and height are specified in pixels.offsetX
- the x offsetoffsetY
- the y offsetwidth
- the widthheight
- the heightMalisisIcon
public MalisisIcon clip(float offsetXFactor, float offsetYFactor, float widthFactor, float heightFactor)
MalisisIcon
. offsetXFactor, offsetYFactor, widthFactor and heightFactor are values
from zero to one.offsetXFactor
- the x factor for offsetoffsetYFactor
- the y factor for offsetwidthFactor
- the width factorheightFactor
- the height factorMalisisIcon
public void initSprite(int width, int height, int x, int y, boolean rotated)
MalisisIcon
is stiched to the texture. Sets most of the icon fields.initSprite
in class net.minecraft.client.renderer.texture.TextureAtlasSprite
width
- the widthheight
- the heightx
- the xy
- the yrotated
- the rotatedpublic void copyFrom(MalisisIcon base)
base
to this MalisisIcon
.base
- the icon to copy frompublic MalisisIcon copy()
MalisisIcon
from this MalisisIcon
.MalisisIcon
public MalisisIcon register(net.minecraft.client.renderer.texture.TextureMap register)
MalisisIcon
to the TextureMap
. If an IIcon
is already registered with this name,
that registered icon will be returned instead.register
- the TextureMapMalisisIcon
if not already registered, otherwise, the MalisisIcon already inside the registry.