Expand ArmorStand API

Adds the following:
- Add proper methods for getting and setting items in both hands. Deprecates old methods
- Enable/Disable slot interactions
- Allow using degrees for ArmorStand rotations (via new Rotations class)

Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
This commit is contained in:
willies952002
2018-07-26 02:22:44 -04:00
parent 134ca58ee1
commit 2a9bc8abb9
3 changed files with 295 additions and 2 deletions

View File

@@ -14,7 +14,7 @@ public interface ArmorStand extends LivingEntity {
*
* @return the held item
* @see #getEquipment()
* @deprecated prefer {@link EntityEquipment#getItemInHand()}
* @deprecated prefer {@link ArmorStand#getItem(EquipmentSlot)} // Paper
*/
@NotNull
@Deprecated(since = "1.15.2")
@@ -26,7 +26,7 @@ public interface ArmorStand extends LivingEntity {
* @param item the item to hold
* @see #getEquipment()
* @deprecated prefer
* {@link EntityEquipment#setItemInHand(org.bukkit.inventory.ItemStack)}
* {@link ArmorStand#setItem(EquipmentSlot, ItemStack)} // Paper
*/
@Deprecated(since = "1.15.2")
void setItemInHand(@Nullable ItemStack item);
@@ -379,5 +379,169 @@ public interface ArmorStand extends LivingEntity {
* @param tick {@code true} if this armour stand can tick, {@code false} otherwise
*/
void setCanTick(final boolean tick);
/**
* Returns the item the armor stand has
* equip in the given equipment slot
*
* @param slot the equipment slot to get
* @return the ItemStack in the equipment slot
* @throws IllegalArgumentException if the slot is invalid for the entity
*/
@NotNull
ItemStack getItem(@NotNull final org.bukkit.inventory.EquipmentSlot slot);
/**
* Sets the item the armor stand has
* equip in the given equipment slot
*
* @param slot the equipment slot to set
* @param item the item to hold
* @throws IllegalArgumentException if the slot is invalid for the entity
*/
void setItem(@NotNull final org.bukkit.inventory.EquipmentSlot slot, @Nullable final ItemStack item);
/**
* Get the list of disabled slots
*
* @return list of disabled slots
*/
@NotNull
java.util.Set<org.bukkit.inventory.EquipmentSlot> getDisabledSlots();
/**
* Set the disabled slots
*
* This makes it so a player is unable to interact with the Armor Stand to place, remove, or replace an item in the given slot(s)
* Note: Once a slot is disabled, the only way to get an item back it to break the armor stand.
*
* @param slots var-arg array of slots to lock
*/
void setDisabledSlots(@NotNull org.bukkit.inventory.EquipmentSlot... slots);
/**
* Disable specific slots, adding them
* to the currently disabled slots
*
* This makes it so a player is unable to interact with the Armor Stand to place, remove, or replace an item in the given slot(s)
* Note: Once a slot is disabled, the only way to get an item back it to break the armor stand.
*
* @param slots var-arg array of slots to lock
*/
void addDisabledSlots(@NotNull final org.bukkit.inventory.EquipmentSlot... slots);
/**
* Remove the given slots from the disabled
* slots list, enabling them.
*
* This makes it so a player is able to interact with the Armor Stand to place, remove, or replace an item in the given slot(s)
*
* @param slots var-arg array of slots to unlock
*/
void removeDisabledSlots(@NotNull final org.bukkit.inventory.EquipmentSlot... slots);
/**
* Check if a specific slot is disabled
*
* @param slot The slot to check
* @return {@code true} if the slot is disabled, else {@code false}.
*/
boolean isSlotDisabled(@NotNull org.bukkit.inventory.EquipmentSlot slot);
/**
* Returns the ArmorStand's body rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @return the current rotations
*/
@NotNull io.papermc.paper.math.Rotations getBodyRotations();
/**
* Sets the ArmorStand's body rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @param rotations the current rotations
*/
void setBodyRotations(@NotNull io.papermc.paper.math.Rotations rotations);
/**
* Returns the ArmorStand's left arm rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @return the current rotations
*/
@NotNull io.papermc.paper.math.Rotations getLeftArmRotations();
/**
* Sets the ArmorStand's left arm rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @param rotations the current rotations
*/
void setLeftArmRotations(@NotNull io.papermc.paper.math.Rotations rotations);
/**
* Returns the ArmorStand's right arm rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @return the current rotations
*/
@NotNull io.papermc.paper.math.Rotations getRightArmRotations();
/**
* Sets the ArmorStand's right arm rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @param rotations the current rotations
*/
void setRightArmRotations(@NotNull io.papermc.paper.math.Rotations rotations);
/**
* Returns the ArmorStand's left leg rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @return the current rotations
*/
@NotNull io.papermc.paper.math.Rotations getLeftLegRotations();
/**
* Sets the ArmorStand's left leg rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @param rotations the current rotations
*/
void setLeftLegRotations(@NotNull io.papermc.paper.math.Rotations rotations);
/**
* Returns the ArmorStand's right leg rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @return the current rotations
*/
@NotNull io.papermc.paper.math.Rotations getRightLegRotations();
/**
* Sets the ArmorStand's right leg rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @param rotations the current rotations
*/
void setRightLegRotations(@NotNull io.papermc.paper.math.Rotations rotations);
/**
* Returns the ArmorStand's head rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @return the current rotations
*/
@NotNull io.papermc.paper.math.Rotations getHeadRotations();
/**
* Sets the ArmorStand's head rotations as
* {@link io.papermc.paper.math.Rotations}.
*
* @param rotations the current rotations
*/
void setHeadRotations(@NotNull io.papermc.paper.math.Rotations rotations);
// Paper end
}