@AutoLoad public class Icon extends net.minecraft.client.renderer.texture.TextureAtlasSprite
TextureAtlasSprite to allow common operations like clipping and offset.from(String) method so that multiple call with the same name return the same Icon
instance.Icon, use constructors directly.| Modifier and Type | Field and Description |
|---|---|
static int |
BLOCK_TEXTURE_HEIGHT
Height of the block's texture atlas.
|
static int |
BLOCK_TEXTURE_WIDTH
Width of the block's texture atlas.
|
protected java.util.Set<Icon> |
dependants
Lists of Icon 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.
|
static Icon |
missing
Icon version of the missing texture |
protected static java.util.Map<java.lang.String,Icon> |
registeredIcons
Map of all registered
Icon. |
protected int |
rotation
Rotation value (clockwise).
|
protected int |
sheetHeight
Height of the global texture sheet.
|
protected int |
sheetWidth
Width of the global texture sheet.
|
protected static java.util.Map<java.lang.String,VanillaIcon> |
vanillaIcons
Map of all registered
VanillaIcon. |
| Constructor and Description |
|---|
Icon()
Instantiates a new
Icon. |
Icon(java.lang.String name)
Instantiates a new
Icon. |
Icon(java.lang.String name,
float u,
float v,
float U,
float V)
Instantiates a new
Icon. |
Icon(net.minecraft.client.renderer.texture.TextureAtlasSprite icon) |
| Modifier and Type | Method and Description |
|---|---|
Icon |
clip(float offsetXFactor,
float offsetYFactor,
float widthFactor,
float heightFactor)
Clips this
Icon. |
Icon |
clip(int offsetX,
int offsetY,
int width,
int height)
Clips this
Icon. |
Icon |
copy()
Creates a new
Icon from this Icon. |
void |
copyFrom(net.minecraft.client.renderer.texture.TextureAtlasSprite base)
|
Icon |
flip(boolean horizontal,
boolean vertical)
Sets this
Icon to be flipped. |
static Icon |
from(net.minecraft.block.Block block)
|
static Icon |
from(net.minecraft.block.state.IBlockState state)
Gets a
Icon for the texture used for the IBlockState |
static Icon |
from(net.minecraft.item.Item item)
Gets a
Icon for the texture used for the Item |
static Icon |
from(net.minecraft.item.Item item,
int metadata)
Gets a
Icon for the texture used for the Item |
static Icon |
from(java.lang.String name)
Gets a
Icon with the specified name. |
float |
getMaxU()
Gets the max u.
|
float |
getMaxV()
Gets the max v.
|
float |
getMinU()
Gets the min u.
|
float |
getMinV()
Gets the min v.
|
static Icon |
getRegistered(java.lang.String name)
Gets the
Icon registered with specified name. |
int |
getRotation()
Gets the rotation.
|
protected void |
initIcon(Icon baseIcon,
int width,
int height,
int x,
int y,
boolean rotated)
Initializes this
Icon. |
void |
initSprite(int width,
int height,
int x,
int y,
boolean rotated)
Called when the part represented by this
Icon is stiched to the texture. |
boolean |
isFlippedU()
Checks if is flipped u.
|
boolean |
isFlippedV()
Checks if is flipped v.
|
boolean |
isRotated()
Checks if is rotated.
|
Icon |
offset(int offsetX,
int offsetY)
Offsets this
Icon by a specified amount. |
void |
register(net.minecraft.client.renderer.texture.TextureMap map) |
static CallbackResult<java.lang.Void> |
registerIcons(net.minecraft.client.renderer.texture.TextureMap map)
Registers all the
Icon into the TextureMap. |
void |
setRotation(int rotation)
Sets the rotation for this
Icon. |
void |
setSize(int width,
int height)
Sets the size in pixel of this
Icon. |
void |
setUVs(float u,
float v,
float U,
float V)
Sets the u vs.
|
clearFramesTextureData, generateMipmaps, getFrameCount, getFrameTextureData, getIconHeight, getIconName, getIconWidth, getInterpolatedU, getInterpolatedV, getOriginX, getOriginY, getUnInterpolatedU, getUnInterpolatedV, hasAnimationMetadata, hasCustomLoader, load, loadSprite, loadSpriteFrames, makeAtlasSprite, setFramesTextureData, setIconHeight, setIconWidth, toString, updateAnimationprotected static final java.util.Map<java.lang.String,Icon> registeredIcons
Icon. These icons will be stitched with the TextureStitchEvent.protected static final java.util.Map<java.lang.String,VanillaIcon> vanillaIcons
VanillaIcon. These icons will be updated after the TextureStitchEvent.public static int BLOCK_TEXTURE_WIDTH
public static int BLOCK_TEXTURE_HEIGHT
protected int sheetWidth
protected int sheetHeight
protected boolean flippedU
protected boolean flippedV
protected int rotation
protected java.util.Set<Icon> dependants
public Icon(java.lang.String name)
Icon.name - the namepublic Icon()
Icon.public Icon(java.lang.String name,
float u,
float v,
float U,
float V)
Icon.name - the nameu - the uv - the vU - the uV - the vpublic Icon(net.minecraft.client.renderer.texture.TextureAtlasSprite icon)
public void setSize(int width,
int height)
Icon.width - the widthheight - the heightpublic void setUVs(float u,
float v,
float U,
float V)
u - the uv - the vU - the uV - the vpublic float getMinU()
getMinU in class net.minecraft.client.renderer.texture.TextureAtlasSpritepublic float getMaxU()
getMaxU in class net.minecraft.client.renderer.texture.TextureAtlasSpritepublic float getMinV()
getMinV in class net.minecraft.client.renderer.texture.TextureAtlasSpritepublic float getMaxV()
getMaxV in class net.minecraft.client.renderer.texture.TextureAtlasSpritepublic Icon flip(boolean horizontal, boolean vertical)
Icon to be flipped.horizontal - whether to flip horizontallyvertical - whether to flip verticallyIconpublic boolean isFlippedU()
Icon is flipped horizontally.public boolean isFlippedV()
Icon is flipped vertically.public boolean isRotated()
Icon is rotated.public void setRotation(int rotation)
Icon. The icon will be rotated rotation x 90 degrees clockwise.rotation - the rotationpublic int getRotation()
Icon.protected void initIcon(Icon baseIcon, int width, int height, int x, int y, boolean rotated)
Icon. 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 Icon offset(int offsetX, int offsetY)
Icon by a specified amount. offsetX and offsetY are specified in pixels.offsetX - the x offsetoffsetY - the y offsetIconpublic Icon clip(int offsetX, int offsetY, int width, int height)
Icon. offsetX, offsetY, width and height are specified in pixels.offsetX - the x offsetoffsetY - the y offsetwidth - the widthheight - the heightIconpublic Icon clip(float offsetXFactor, float offsetYFactor, float widthFactor, float heightFactor)
Icon. 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 factorIconpublic void initSprite(int width,
int height,
int x,
int y,
boolean rotated)
Icon is stiched to the texture. Sets most of the icon fields.initSprite in class net.minecraft.client.renderer.texture.TextureAtlasSpritewidth - the widthheight - the heightx - the xy - the yrotated - the rotatedpublic void copyFrom(net.minecraft.client.renderer.texture.TextureAtlasSprite base)
copyFrom in class net.minecraft.client.renderer.texture.TextureAtlasSpritebase - the icon to copy frompublic void register(net.minecraft.client.renderer.texture.TextureMap map)
public static CallbackResult<java.lang.Void> registerIcons(net.minecraft.client.renderer.texture.TextureMap map)
Icon into the TextureMap.map - the mappublic static Icon from(java.lang.String name)
Icon with the specified name.name - the namepublic static Icon from(net.minecraft.block.Block block)
block - the blockpublic static Icon from(net.minecraft.block.state.IBlockState state)
Icon for the texture used for the IBlockStatestate - the statepublic static Icon from(net.minecraft.item.Item item)
Icon for the texture used for the Itemitem - the itempublic static Icon from(net.minecraft.item.Item item, int metadata)
Icon for the texture used for the Itemitem - the item