public final class MapImage
extends java.lang.Object
Note that the default anchorX and anchorY will cause the top left of the image to be placed at an associated BlockPos.
To center the image on a BlockPos, use:
mapImage.setAnchorX(mapImage.getDisplayWidth()/2.0).setAnchorY(mapImage.getDisplayHeight()/2.0);
Setters use the Builder pattern so they can be chained.
| Constructor and Description |
|---|
MapImage(com.mojang.blaze3d.platform.NativeImage image)
Constructor.
|
MapImage(com.mojang.blaze3d.platform.NativeImage image,
int textureX,
int textureY,
int textureWidth,
int textureHeight,
int color,
float opacity)
Constructor.
|
MapImage(net.minecraft.resources.ResourceLocation imageLocation,
int textureWidth,
int textureHeight)
Constructor.
|
MapImage(net.minecraft.resources.ResourceLocation imageLocation,
int textureX,
int textureY,
int textureWidth,
int textureHeight,
int color,
float opacity)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
MapImage |
centerAnchors()
Centers the image on the associated position.
|
boolean |
equals(java.lang.Object o) |
double |
getAnchorX()
Gets anchor x.
|
double |
getAnchorY()
Gets anchor y.
|
int |
getColor()
Gets color.
|
double |
getDisplayHeight()
Gets the image height in pixels when rendered.
|
double |
getDisplayWidth()
Gets the display width in pixels when rendered.
|
com.mojang.blaze3d.platform.NativeImage |
getImage()
Gets the image, if there is one.
|
net.minecraft.resources.ResourceLocation |
getImageLocation()
Gets the image location, if there is one.
|
float |
getOpacity()
Gets opacity.
|
int |
getRotation()
Gets the rotation in degrees the image should be oriented.
|
int |
getTextureHeight()
Gets the image textureHeight.
|
int |
getTextureWidth()
Gets the image textureWidth.
|
int |
getTextureX()
Gets X coordinate in BufferedImage where image begins.
|
int |
getTextureY()
Gets Y coordinate in BufferedImage where image begins.
|
int |
hashCode() |
boolean |
isBlur() |
MapImage |
setAnchorX(double anchorX)
Sets anchor x.
|
MapImage |
setAnchorY(double anchorY)
Sets anchor y.
|
MapImage |
setBlur(boolean blur)
Sets the blur,
True will use GL_LINEAR which will give AA to the image.
|
MapImage |
setColor(int color)
Sets color used to tint the image.
|
MapImage |
setDisplayHeight(double displayHeight)
Sets the image height in pixels when rendered, allowing the image
to be scaled if needed.
|
MapImage |
setDisplayWidth(double displayWidth)
Sets the image width in pixels when rendered, allowing the image
to be scaled if needed.
|
MapImage |
setOpacity(float opacity)
Sets opacity.
|
MapImage |
setRotation(int rotation)
Sets the rotation in degrees the image should be oriented.
|
java.lang.String |
toString() |
public MapImage(com.mojang.blaze3d.platform.NativeImage image)
Defaults tint to white (0xffffff) and opacity to 1f. Defaults displayWidth and displayHeight to the texture dimensions.
image - Image texturepublic MapImage(com.mojang.blaze3d.platform.NativeImage image,
int textureX,
int textureY,
int textureWidth,
int textureHeight,
int color,
float opacity)
Defaults displayWidth and displayHeight to the texture dimensions.
image - Image texturetextureX - Start x of texture within image. Useful in sprite sheets.textureY - Start y of texture within image. Useful in sprite sheets.textureWidth - texture widthtextureHeight - texture heightcolor - Sets a color tint (rgb) on the image. Use white (0xffffff) for no tint.opacity - opacity between 0 and 1public MapImage(net.minecraft.resources.ResourceLocation imageLocation,
int textureWidth,
int textureHeight)
imageLocation - location for imagetextureWidth - width of texturetextureHeight - height of texturepublic MapImage(net.minecraft.resources.ResourceLocation imageLocation,
int textureX,
int textureY,
int textureWidth,
int textureHeight,
int color,
float opacity)
imageLocation - Resource location for texture image.textureX - Start x of texture within image. Useful in sprite sheets.textureY - Start y of texture within image. Useful in sprite sheets.textureWidth - texture widthtextureHeight - texture heightcolor - Sets a color tint (rgb) on the image. Use white (0xffffff) for no tint.opacity - opacity between 0 and 1public int getColor()
public MapImage setColor(int color)
color - the colorpublic float getOpacity()
public MapImage setOpacity(float opacity)
opacity - the opacitypublic int getTextureX()
public int getTextureY()
public double getAnchorX()
public MapImage setAnchorX(double anchorX)
anchorX - the anchor xpublic double getAnchorY()
public MapImage setAnchorY(double anchorY)
anchorY - the anchor ypublic MapImage centerAnchors()
public boolean isBlur()
public MapImage setBlur(boolean blur)
blur - public int getTextureWidth()
public int getTextureHeight()
@Nullable public net.minecraft.resources.ResourceLocation getImageLocation()
@Nullable public com.mojang.blaze3d.platform.NativeImage getImage()
public int getRotation()
public MapImage setRotation(int rotation)
rotation - in degreespublic double getDisplayWidth()
public MapImage setDisplayWidth(double displayWidth)
public double getDisplayHeight()
public MapImage setDisplayHeight(double displayHeight)
public boolean equals(@Nullable
java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object