mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 22:13:42 +01:00
36f34f01c0
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: da9ef3c5 #496: Add methods to get/set ItemStacks in EquipmentSlots 3abebc9f #492: Let Tameable extend Animals rather than Entity 941111a0 #495: Expose ItemStack and hand used in PlayerShearEntityEvent 4fe19cae #494: InventoryView - Add missing Brewing FUEL_TIME CraftBukkit Changes:933e9094
#664: Add methods to get/set ItemStacks in EquipmentSlots18722312
#662: Expose ItemStack and hand used in PlayerShearEntityEvent
112 lines
4.1 KiB
Diff
112 lines
4.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: willies952002 <admin@domnian.com>
|
|
Date: Thu, 26 Jul 2018 02:22:44 -0400
|
|
Subject: [PATCH] Expand ArmorStand API
|
|
|
|
Add the following:
|
|
- Add proper methods for getting and setting items in both hands. Deprecates old methods
|
|
- Enable/Disable slot interactions
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
|
|
index c8c08f1f2cf875f3bab7548cebd3dd657a5bf3ec..af70bac7921852b58629d671fe03ad0e23be9266 100644
|
|
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
|
|
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
|
|
@@ -1,6 +1,7 @@
|
|
package org.bukkit.entity;
|
|
|
|
import org.bukkit.inventory.EntityEquipment;
|
|
+import org.bukkit.inventory.EquipmentSlot;
|
|
import org.bukkit.inventory.ItemStack;
|
|
import org.bukkit.util.EulerAngle;
|
|
import org.jetbrains.annotations.NotNull;
|
|
@@ -12,7 +13,7 @@ public interface ArmorStand extends LivingEntity {
|
|
* Returns the item the armor stand is currently holding.
|
|
*
|
|
* @return the held item
|
|
- * @deprecated prefer {@link EntityEquipment#getItemInHand()}
|
|
+ * @deprecated prefer {@link ArmorStand#getItem(EquipmentSlot)} // Paper
|
|
* @see #getEquipment()
|
|
*/
|
|
@NotNull
|
|
@@ -24,7 +25,7 @@ public interface ArmorStand extends LivingEntity {
|
|
*
|
|
* @param item the item to hold
|
|
* @deprecated prefer
|
|
- * {@link EntityEquipment#setItemInHand(org.bukkit.inventory.ItemStack)}
|
|
+ * {@link ArmorStand#setItem(EquipmentSlot, ItemStack)} // Paper
|
|
* @see #getEquipment()
|
|
*/
|
|
@Deprecated
|
|
@@ -324,5 +325,71 @@ 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
|
|
+ */
|
|
+ @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
|
|
+ */
|
|
+ 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);
|
|
// Paper end
|
|
}
|