Interface Equipable
-
- All Known Subinterfaces:
Aerial
,Ageable
,Agent
,Ambient
,Animal
,Aquatic
,ArmorEquipable
,ArmorStand
,Bat
,Bee
,Blaze
,Boss
,Cat
,CaveSpider
,Chicken
,ClientPlayer
,Cod
,Cow
,Creature
,Creeper
,Dolphin
,Donkey
,Drowned
,ElderGuardian
,EnderDragon
,Enderman
,Endermite
,Evoker
,Fish
,Fox
,Ghast
,Giant
,Golem
,Guardian
,Hoglin
,Horse
,HorseLike
,Hostile
,Human
,Humanoid
,Husk
,Illager
,Illusioner
,IronGolem
,Llama
,LlamaLike
,LocalPlayer
,MagmaCube
,Monster
,Mooshroom
,Mule
,Ocelot
,PackHorse
,Panda
,Parrot
,Patroller
,Phantom
,Pig
,Piglin
,PiglinBrute
,PiglinLike
,Pillager
,Player
,PolarBear
,Pufferfish
,Rabbit
,Raider
,Ranger
,Ravager
,RemotePlayer
,Salmon
,SchoolingFish
,ServerPlayer
,Sheep
,Shulker
,Silverfish
,Skeleton
,SkeletonHorse
,SkeletonLike
,Slime
,SnowGolem
,Spellcaster
,Spider
,Squid
,Stray
,Strider
,TameableAnimal
,TameableHorse
,Trader
,TraderLlama
,TropicalFish
,Turtle
,User
,Vex
,Villager
,Vindicator
,WanderingTrader
,Witch
,Wither
,WitherSkeleton
,Wolf
,Zoglin
,Zombie
,ZombieHorse
,ZombieLike
,ZombieVillager
,ZombifiedPiglin
public interface Equipable
Represents the holder of aEquipmentInventory
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
canEquip(java.util.function.Supplier<? extends EquipmentType> type)
default boolean
canEquip(java.util.function.Supplier<? extends EquipmentType> type, ItemStack equipment)
boolean
canEquip(EquipmentType type)
Gets whether thisEquipable
can equip equipment of the specified type (eg.boolean
canEquip(EquipmentType type, ItemStack equipment)
Gets whether thisEquipable
can equip the supplied equipment in its slot of the specified type (eg.default boolean
equip(java.util.function.Supplier<? extends EquipmentType> type, ItemStack equipment)
boolean
equip(EquipmentType type, ItemStack equipment)
Sets the item currently equipped by theEquipable
in the specified slot, if the equipable has such a slot.EquipmentInventory
equipment()
Returns the EquipmentInventory this is holding.default java.util.Optional<ItemStack>
equipped(java.util.function.Supplier<? extends EquipmentType> type)
java.util.Optional<ItemStack>
equipped(EquipmentType type)
Gets the item currently equipped by thisEquipable
in the specified slot.
-
-
-
Method Detail
-
equipment
EquipmentInventory equipment()
Returns the EquipmentInventory this is holding.- Returns:
- The EquipmentInventory this is holding
-
canEquip
boolean canEquip(EquipmentType type)
Gets whether thisEquipable
can equip equipment of the specified type (eg. whether callingequip(org.spongepowered.api.item.inventory.equipment.EquipmentType, org.spongepowered.api.item.inventory.ItemStack)
will fail because the equipable doesn't have this type of slot.- Parameters:
type
- The type of equipment slot to query- Returns:
- true if this equipable can equip items of the specified type
-
canEquip
default boolean canEquip(java.util.function.Supplier<? extends EquipmentType> type)
-
canEquip
boolean canEquip(EquipmentType type, ItemStack equipment)
Gets whether thisEquipable
can equip the supplied equipment in its slot of the specified type (eg. whether callingequip(org.spongepowered.api.item.inventory.equipment.EquipmentType, org.spongepowered.api.item.inventory.ItemStack)
with the specified slot type and item will succeed)- Parameters:
type
- The type of equipment slot to queryequipment
- The equipment to check for- Returns:
- true if can equip the supplied equipment
-
canEquip
default boolean canEquip(java.util.function.Supplier<? extends EquipmentType> type, ItemStack equipment)
-
equipped
java.util.Optional<ItemStack> equipped(EquipmentType type)
Gets the item currently equipped by thisEquipable
in the specified slot.- Parameters:
type
- The type of equipment slot to query- Returns:
- The item in the equipped slot, if available
-
equipped
default java.util.Optional<ItemStack> equipped(java.util.function.Supplier<? extends EquipmentType> type)
-
equip
boolean equip(EquipmentType type, ItemStack equipment)
Sets the item currently equipped by theEquipable
in the specified slot, if the equipable has such a slot.- Parameters:
type
- The type of equipment slot to setequipment
- The equipment to set the any equipped item- Returns:
- true if the item was successfully equipped, false if the item could not be equipped because the equipable doesn't support the specified equipment type or because the item was incompatible with the specified slot.
-
equip
default boolean equip(java.util.function.Supplier<? extends EquipmentType> type, ItemStack equipment)
-
-