handle BODY slot for non-mobs (#10822)

This commit is contained in:
Jake Potrebic 2024-05-29 11:23:51 -07:00 committed by GitHub
parent 84f6e6e0b1
commit 672c07728f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 67 additions and 7 deletions

View file

@ -150,7 +150,7 @@ index 0000000000000000000000000000000000000000..53359ab4a6659bce895deef6a21cde84
+
+}
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
index 2ee3814a52945f541e049b621b9552f8ae9e261d..7530eb5d2a506e13e2bc7e189fd6e957c013cdf5 100644
index 2ee3814a52945f541e049b621b9552f8ae9e261d..575d58d96445e9ef3711cd6613471d5fe17bbb10 100644
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
@@ -14,7 +14,7 @@ public interface ArmorStand extends LivingEntity {
@ -171,7 +171,7 @@ index 2ee3814a52945f541e049b621b9552f8ae9e261d..7530eb5d2a506e13e2bc7e189fd6e957
*/
@Deprecated
void setItemInHand(@Nullable ItemStack item);
@@ -379,5 +379,167 @@ public interface ArmorStand extends LivingEntity {
@@ -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);
@ -182,6 +182,7 @@ index 2ee3814a52945f541e049b621b9552f8ae9e261d..7530eb5d2a506e13e2bc7e189fd6e957
+ *
+ * @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);
@ -192,6 +193,7 @@ index 2ee3814a52945f541e049b621b9552f8ae9e261d..7530eb5d2a506e13e2bc7e189fd6e957
+ *
+ * @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);
+

View file

@ -17,6 +17,36 @@ index 8ba00f743b61cd33dd41ae7f1c272ee2b0c8546d..7cc1fd241e1f62a9fe9b5849110c0a3d
public EquipmentSlot getSlot() {
return slot == EquipmentSlotGroup.ANY ? null : slot.getExample();
}
diff --git a/src/main/java/org/bukkit/inventory/EntityEquipment.java b/src/main/java/org/bukkit/inventory/EntityEquipment.java
index 1b34286fb6cbedb3841c84c499eb626f61885126..0829418cc4b586ea9c800617f7184b1e60f756a6 100644
--- a/src/main/java/org/bukkit/inventory/EntityEquipment.java
+++ b/src/main/java/org/bukkit/inventory/EntityEquipment.java
@@ -15,6 +15,7 @@ public interface EntityEquipment {
*
* @param slot the slot to put the ItemStack
* @param item the ItemStack to set
+ * @throws IllegalArgumentException if the slot is invalid for the entity
*/
public void setItem(@NotNull EquipmentSlot slot, @Nullable ItemStack item);
@@ -23,7 +24,8 @@ public interface EntityEquipment {
*
* @param slot the slot to put the ItemStack
* @param item the ItemStack to set
- * @param silent whether or not the equip sound should be silenced
+ * @param silent whether the equip sound should be silenced
+ * @throws IllegalArgumentException if the slot is invalid for the entity
*/
public void setItem(@NotNull EquipmentSlot slot, @Nullable ItemStack item, boolean silent);
@@ -32,6 +34,7 @@ public interface EntityEquipment {
*
* @param slot the slot to get the ItemStack
* @return the ItemStack in the given slot
+ * @throws IllegalArgumentException if the slot is invalid for the entity
*/
@NotNull
public ItemStack getItem(@NotNull EquipmentSlot slot);
diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java b/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java
index 82416a078f697f627916c578e6c2dbc003519acf..f72aa9cfd2d1472cf26600ac0f2380660069407d 100644
--- a/src/main/java/org/bukkit/inventory/EquipmentSlotGroup.java