Interface Stackable<T>
- Type Parameters:
T-
- All Known Implementing Classes:
BalloonScroll,BlankPetScroll,ConsumableItem,Drink,EmptyScroll,ExaminableItem,Food,InvitationScroll,MarkedScroll,Money,NoStatsProjectile,Projectile,RainbowBeansScroll,Scroll,Seed,StackableItem,StatusHealer,SummonPetScroll,SummonScroll,TeleportScroll,TimedInvisibility,TimedStackableItem,TimedTeleportScroll,TwilightElixir,TwilightMossScroll
public interface Stackable<T>
this interface tags all items which are stackable.
- Author:
- mtotz
-
Method Summary
Modifier and TypeMethodDescriptionintAdds the quantity of the other Stackable to this.intgets the maximum amountintgets the current quantitybooleanisStackable(T other) checks if the other object can be stacked onto this onevoidsetCapacity(int capacity) sets the maximum amountvoidsetQuantity(int amount) sets the quantity.
-
Method Details
-
getQuantity
int getQuantity()gets the current quantity- Returns:
- the quantity
-
setQuantity
void setQuantity(int amount) sets the quantity.- Parameters:
amount- to be set
-
getCapacity
int getCapacity()gets the maximum amount- Returns:
- the maximum amount
-
setCapacity
void setCapacity(int capacity) sets the maximum amount- Parameters:
capacity-
-
add
Adds the quantity of the other Stackable to this.- Parameters:
other- other object to merge in- Returns:
- the previous quantity
-
isStackable
checks if the other object can be stacked onto this one- Parameters:
other- other object- Returns:
- true when both stackables are of the same type and can be merged
-