SmithingAPI
API for interacting with the OSRS Smithing interface.
ClassRLPlugins API
public class SmithingAPIProvides methods to smith various items, check smithing conditions, and query available smithable items by bar type.
Members
Static methods
- booleancanSmith(SmithableItem, int, int)
Checks if the player can smith a specific item with the given quantity.
- voidclose()
Closes the smithing interface if it is open.
- SmithableItemgetItemByName(BarType, String)
Finds a smithable item by its base name within a specific bar type.
- List<SmithableItem>getItemsForBarType(BarType)
Gets all smithable items available for a specific bar type.
- intgetMaxSmithableAmount(SmithableItem, int)
Calculates the maximum number of items that can be smithed with available bars.
- booleanhasEnoughBars(SmithableItem, int, int)
Checks if the player has enough bars to smith the specified quantity of an item.
- booleanhasHammer()
Checks if the player has a hammer required for smithing.
- booleanisAccessible(SmithableItem)
Checks if a smithable item is accessible to the player.
- booleanisOpen()
Checks if the smithing interface is currently open.
- booleanisSmithing()
Checks if the player is currently smithing.
- booleansmith(SmithableItem, int, int)
Attempts to smith a specified item with the given quantity.
canSmith(SmithableItem, int, int)static
public static boolean canSmith(SmithableItem item, int amount, int barId)Checks if the player can smith a specific item with the given quantity.
Combines checks for bars, hammer, and accessibility.
Parameters
item- The item to check.
amount- The quantity to smith.
barId- The ID of the bar type to use.
Returns
True if all conditions are met to smith the item, false otherwise.
close()static
public static void close()Closes the smithing interface if it is open.
getItemByName(BarType, String)static
public static SmithableItem getItemByName(BarType barType, String baseName)Finds a smithable item by its base name within a specific bar type.
The base name excludes the metal prefix (e.g., "platebody" instead of "Bronze platebody"). Search is case-insensitive and trims whitespace.
Parameters
barType- The bar type to search within.
baseName- The base name of the item (e.g., "sword", "platebody").
Returns
The matching SmithableItem, or null if not found.
getItemsForBarType(BarType)static
public static List<SmithableItem> getItemsForBarType(BarType barType)Gets all smithable items available for a specific bar type.
Parameters
barType- The bar type to query.
Returns
A list of smithable items for the bar type (empty list if none).
getMaxSmithableAmount(SmithableItem, int)static
public static int getMaxSmithableAmount(SmithableItem item, int barId)Calculates the maximum number of items that can be smithed with available bars.
Parameters
item- The item to check.
barId- The ID of the bar type to use.
Returns
The maximum smithable quantity (0 if no bars available).
hasEnoughBars(SmithableItem, int, int)static
public static boolean hasEnoughBars(SmithableItem item, int amount, int barId)Checks if the player has enough bars to smith the specified quantity of an item.
Parameters
item- The item to check.
amount- The quantity to smith (-1 checks for at least 1 bar per item).
barId- The ID of the bar type to check.
Returns
True if sufficient bars are available, false otherwise.
hasHammer()static
public static boolean hasHammer()Checks if the player has a hammer required for smithing.
Accepts either a regular hammer or Imcando hammer in inventory or equipped.
Returns
True if a player has a hammer available, false otherwise.
isAccessible(SmithableItem)static
public static boolean isAccessible(SmithableItem item)Checks if a smithable item is accessible to the player.
An item is accessible if it has no requirements or all requirements are met.
Parameters
item- The item to check.
Returns
True if the item is accessible, false if null or requirements not met.
isOpen()static
public static boolean isOpen()Checks if the smithing interface is currently open.
Returns
True if the smithing interface is visible, false otherwise.
isSmithing()static
public static boolean isSmithing()Checks if the player is currently smithing.
Returns
True if the player is actively smithing, false otherwise.
smith(SmithableItem, int, int)static
public static boolean smith(SmithableItem item, int amount, int barId)Attempts to smith a specified item with the given quantity.
Parameters
item- The item to smith (must not be null).
amount- The quantity: 1, 5, 10, -1 for All, or any other value for X.
barId- The ID of the bar type to use.
Returns
True if smithing was initiated successfully, false otherwise.
Also allowed
Every class has these, as in plain Java.
equals, toString