api: expand item api for inventory model replacement

This commit is contained in:
Adam
2022-03-01 09:54:26 -05:00
parent cda29d36b8
commit e839dc15c3
2 changed files with 116 additions and 13 deletions

View File

@@ -397,6 +397,20 @@ public interface Client extends GameEngine
@Nullable @Nullable
SpritePixels createItemSprite(int itemId, int quantity, int border, int shadowColor, @MagicConstant(valuesFromClass = ItemQuantityMode.class) int stackable, boolean noted, int scale); SpritePixels createItemSprite(int itemId, int quantity, int border, int shadowColor, @MagicConstant(valuesFromClass = ItemQuantityMode.class) int stackable, boolean noted, int scale);
/**
* Get the item model cache. These models are used for drawing widgets of type {@link net.runelite.api.widgets.WidgetType#MODEL}
* and inventory item icons
* @return
*/
NodeCache getItemModelCache();
/**
* Get the item sprite cache. These are 2d SpritePixels which are used to raster item images on the inventory and
* on widgets of type {@link net.runelite.api.widgets.WidgetType#GRAPHIC}
* @return
*/
NodeCache getItemSpriteCache();
/** /**
* Loads and creates the sprite images of the passed archive and file IDs. * Loads and creates the sprite images of the passed archive and file IDs.
* *

View File

@@ -32,12 +32,18 @@ import javax.annotation.Nullable;
public interface ItemComposition extends ParamHolder public interface ItemComposition extends ParamHolder
{ {
/** /**
* Gets the items name. * Gets the item's name.
* *
* @return the name of the item * @return the name of the item
*/ */
String getName(); String getName();
/**
* Sets the item's name.
* @param name the new name
*/
void setName(String name);
/** /**
* Gets the items ID. * Gets the items ID.
* *
@@ -144,12 +150,6 @@ public interface ItemComposition extends ParamHolder
*/ */
void setShiftClickActionIndex(int shiftClickActionIndex); void setShiftClickActionIndex(int shiftClickActionIndex);
/**
* Resets the menu action index of the shift-click action to its
* default value.
*/
void resetShiftClickActionIndex();
/** /**
* Gets the model ID of the inventory item. * Gets the model ID of the inventory item.
* *
@@ -158,20 +158,109 @@ public interface ItemComposition extends ParamHolder
int getInventoryModel(); int getInventoryModel();
/** /**
* Since the client reuses item models, it stores colors that can be replaced. * Set the model ID of the inventory item. You will also need to flush the item model cache and the item
* This returns what colors the item model will be replaced with. * sprite cache to have the changes fully propagated after changing this value.
* * @see Client#getItemModelCache()
* @see Client#getItemSpriteCache()
*/
void setInventoryModel(int model);
/**
* Get the colors to be replaced on this item's model for this item.
* @see JagexColor
* @see ItemComposition#getColorToReplaceWith()
* @return the colors to be replaced
*/
@Nullable
short[] getColorToReplace();
/**
* Set the colors to be replaced on this item's model for this item.
* @see JagexColor
* @see ItemComposition#setColorToReplaceWith(short[])
*/
void setColorToReplace(short[] colorsToReplace);
/**
* Get the colors applied to this item's model for this item.
* @see JagexColor
* @see ItemComposition#getColorToReplace()
* @return the colors to replace with * @return the colors to replace with
*/ */
@Nullable @Nullable
short[] getColorToReplaceWith(); short[] getColorToReplaceWith();
/** /**
* Since the client reuses item models, it stores textures that can be replaced. * Set the colors applied to this item's model for this item.
* This returns what textures the item model will be replaced with. * @see JagexColor
* * @see ItemComposition#setColorToReplace(short[])
*/
void setColorToReplaceWith(short[] colorToReplaceWith);
/**
* Get the textures to be replaced on this item's model for this item.
* @see ItemComposition#getTextureToReplaceWith()
* @return the textures to be replaced
*/
@Nullable
short[] getTextureToReplace();
/**
* Set the textures to be replaced on this item's model for this item.
* @see ItemComposition#setTextureToReplaceWith(short[])
*/
void setTextureToReplace(short[] textureToFind);
/**
* Get the textures applied to this item's model for this item.
* @see ItemComposition#getTextureToReplace()
* @return the textures to replace with * @return the textures to replace with
*/ */
@Nullable @Nullable
short[] getTextureToReplaceWith(); short[] getTextureToReplaceWith();
/**
* Set the textures applied to this item's model for this item.
* @see ItemComposition#setTextureToReplace(short[])
*/
void setTextureToReplaceWith(short[] textureToReplaceWith);
/**
* Get the x angle for 2d item sprites used in the inventory.
* @see net.runelite.api.coords.Angle
* @return
*/
int getXan2d();
/**
* Get the y angle for 2d item sprites used in the inventory.
* @see net.runelite.api.coords.Angle
* @return
*/
int getYan2d();
/**
* Get the z angle for 2d item sprites used in the inventory.
* @see net.runelite.api.coords.Angle
* @return
*/
int getZan2d();
/**
* Set the x angle for 2d item sprites used in the inventory.
* @see net.runelite.api.coords.Angle
*/
void setXan2d(int angle);
/**
* Set the y angle for 2d item sprites used in the inventory.
* @see net.runelite.api.coords.Angle
*/
void setYan2d(int angle);
/**
* Set the z angle for 2d item sprites used in the inventory.
* @see net.runelite.api.coords.Angle
*/
void setZan2d(int angle);
} }