EssencePouch
Utility class for managing runecrafting essence pouches.
ClassRLPlugins API
public class EssencePouchProvides methods to fill, empty, and track pouch degradation.
This class represents an instance of a pouch in the player's inventory and depends on the client state. For static pouch data, see PouchType.
Members
Methods
- booleancheck()
Check the pouch contents (displays an info message in-game).
- booleanempty()
Empty the pouch.
- voidemptyAll()
Empty all essence pouches in inventory (largest to smallest).
- booleanfill()
Fill the pouch with any essences in inventory.
- booleanfill(int)
Fill the pouch with a specific essence type.
- booleanfill(int[])
Core fill logic.
- voidfillAll()
Fill all essence pouches in the inventory (largest to smallest) with any essence type.
- voidfillAll(int)
Fill all essence pouches in the inventory (largest to smallest) with a specific essence type.
- voidfillAllSafe()
Safely fill all essence pouches in inventory (largest to smallest) with any essence type.
- voidfillAllSafe(int)
Safely fill all essence pouches in inventory (largest to smallest) with a specific essence type.
- booleanfillSafe()
Safely fill the pouch with any essences in inventory.
- booleanfillSafe(int)
Safely fill the pouch with a specific essence type.
- booleanfillSafe(int[])
Core "safe" fill logic.
- EssencePouchfromItem(ItemEx)
Create an EssencePouch from an ItemEx.
- intgetActualCapacity()
Get actual capacity (accounting for degradation and level).
- List<EssencePouch>getAllPouches()
Get all essence pouches found in inventory.
- intgetCurrentAmount()
Get the current amount of essence in the pouch.
- ItemExgetItem()
The item.
- intgetMaxCapacity()
Get the maximum capacity of this pouch (ignoring degradation/level).
- EssencePouchgetPouch()
Get the first essence pouch found in inventory.
- PouchTypegetPouchType()
The pouch type.
- intgetRemainingFills()
Get remaining fills before the next degradation.
- booleanisAnyDegraded()
Check if any essence pouch in inventory is degraded.
- booleanisAnyNotFull()
Checks if any pouch currently held in the inventory is not at its maximum capacity.
- booleanisDegraded()
Check if this pouch is degraded (broken state).
- booleanisEmpty()
Check if the pouch is empty.
- booleanisFull()
Check if the pouch is full.
check()
public boolean check()Check the pouch contents (displays an info message in-game).
Returns
True if check action was initiated, false if failed.
empty()
public boolean empty()Empty the pouch.
Requires at least one free slot; the game transfers only the essence that fits.
Returns
True if empty action was initiated, false if preconditions not met.
emptyAll()static
public static void emptyAll()Empty all essence pouches in inventory (largest to smallest).
Only empties pouches if there's enough inventory space. Stops if inventory becomes full.
fill()
public boolean fill()Fill the pouch with any essences in inventory.
Checks if there's enough essence and if the pouch has space.
Returns
True if fill action was initiated, false if preconditions not met.
fill(int)
public boolean fill(int essenceId)Fill the pouch with a specific essence type.
Parameters
essenceId- The specific essence item ID to fill with (must be one of ESSENCE_IDS).
Returns
True if fill action was initiated, false if preconditions not met.
fill(int[])
public boolean fill(int[] essenceIds)Core fill logic.
Fills the pouch with any of the specified essence types.
Parameters
essenceIds- Array of essence IDs to check count for.
Returns
True if fill action was initiated, false otherwise.
fillAll()static
public static void fillAll()Fill all essence pouches in the inventory (largest to smallest) with any essence type.
This method *will* fill pouches that are about to degrade (but will warn).
fillAll(int)static
public static void fillAll(int essenceId)Fill all essence pouches in the inventory (largest to smallest) with a specific essence type.
This method *will* fill pouches that are about to degrade (but will warn).
Parameters
essenceId- The specific essence item ID to fill with.
fillAllSafe()static
public static void fillAllSafe()Safely fill all essence pouches in inventory (largest to smallest) with any essence type.
This method will *skip* filling any pouch that is about to degrade.
fillAllSafe(int)static
public static void fillAllSafe(int essenceId)Safely fill all essence pouches in inventory (largest to smallest) with a specific essence type.
This method will *skip* filling any pouch that is about to degrade.
Parameters
essenceId- The specific essence item ID to fill with.
fillSafe()
public boolean fillSafe()Safely fill the pouch with any essences in inventory.
This method will *not* fill the pouch if it is about to degrade.
Returns
True if fill action was initiated, false if preconditions not met or if fill was skipped for safety.
fillSafe(int)
public boolean fillSafe(int essenceId)Safely fill the pouch with a specific essence type.
This method will *not* fill the pouch if it is about to degrade.
Parameters
essenceId- The specific essence item ID to fill with.
Returns
True if fill action was initiated, false if preconditions not met or if fill was skipped for safety.
fillSafe(int[])
public boolean fillSafe(int[] essenceIds)Core "safe" fill logic.
Skips filling if the pouch is 1 fill away from degrading.
Parameters
essenceIds- Array of essence IDs to check count for.
Returns
True if fill action was initiated, false otherwise.
fromItem(ItemEx)static
public static EssencePouch fromItem(ItemEx item)Create an EssencePouch from an ItemEx.
Parameters
item- The item to create a pouch from.
Returns
EssencePouch instance, or null if the item is not a pouch.
getActualCapacity()
public int getActualCapacity()Get actual capacity (accounting for degradation and level).
This method fetches the live RC level from the client.
Returns
Current maximum capacity of the pouch.
getAllPouches()static
public static List<EssencePouch> getAllPouches()Get all essence pouches found in inventory.
Returns
List of all essence pouches found in inventory, or empty list if none found.
getCurrentAmount()
public int getCurrentAmount()Get the current amount of essence in the pouch.
Returns
Amount of essence currently stored.
getItem()
public ItemEx getItem()The item.
getMaxCapacity()
public int getMaxCapacity()Get the maximum capacity of this pouch (ignoring degradation/level).
Returns
Maximum capacity value.
getPouch()static
public static EssencePouch getPouch()Get the first essence pouch found in inventory.
Returns
First EssencePouch found, or null if none found.
getPouchType()
public PouchType getPouchType()The pouch type.
getRemainingFills()
public int getRemainingFills()Get remaining fills before the next degradation.
This method fetches the live RC level from the client.
Returns
The number of fills remaining before the pouch degrades further.
isAnyDegraded()static
public static boolean isAnyDegraded()Check if any essence pouch in inventory is degraded.
Returns
True if at least one pouch is in the degraded state.
isAnyNotFull()static
public static boolean isAnyNotFull()Checks if any pouch currently held in the inventory is not at its maximum capacity.
Returns
True if at least one pouch can still hold more essence, false otherwise.
isDegraded()
public boolean isDegraded()Check if this pouch is degraded (broken state).
Returns
True if pouch is in degraded state, false otherwise.
isEmpty()
public boolean isEmpty()Check if the pouch is empty.
Returns
True if the pouch contains no essence.
isFull()
public boolean isFull()Check if the pouch is full.
Returns
True if the pouch is at maximum capacity.
Also allowed
Every class has these, as in plain Java.
equals, toString