From 033884432d361b372246e03ea1adefa48ea68039 Mon Sep 17 00:00:00 2001 From: Strokkur24 Date: Mon, 13 Jul 2026 23:26:06 +0200 Subject: [PATCH] Add SulfurCube#equipItem --- .../java/org/bukkit/entity/SulfurCube.java | 25 +++++++++++++++++++ .../craftbukkit/entity/CraftSulfurCube.java | 7 ++++++ 2 files changed, 32 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/entity/SulfurCube.java b/paper-api/src/main/java/org/bukkit/entity/SulfurCube.java index cc7cbf395665..6e92c169a0dc 100644 --- a/paper-api/src/main/java/org/bukkit/entity/SulfurCube.java +++ b/paper-api/src/main/java/org/bukkit/entity/SulfurCube.java @@ -7,6 +7,7 @@ import net.kyori.adventure.key.Key; import net.kyori.adventure.key.KeyPattern; import org.bukkit.Keyed; +import org.bukkit.inventory.ItemStack; import org.jspecify.annotations.NullMarked; /** @@ -73,6 +74,30 @@ default boolean ignite() { return this.ignite(false); } + /** + * Equips the provided item to this sulfur cube, following any Vanilla logic. + *

+ * This method will: + *

+ *

+ * If you want to circumvent the above-mentioned Vanilla logic, you can instead directly edit + * the body equipment slot of the sulfur cube, like this: + *

{@code
+     * sulfurCube.getEquipment().setItem(
+     *   EquipmentSlot.BODY,
+     *   itemStack
+     * );
+     * }
+ * + * @param itemStack the item to equip. Use {@link ItemStack#empty()} to unset the item + * @return whether the sulfur cube's absorbed item was updated + */ + boolean equipItem(ItemStack itemStack); + /** * Represents the archetype of a sulfur cube * which define a lot of possible behavior and interaction diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftSulfurCube.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftSulfurCube.java index 7a2e9c8d693c..529ffff7e026 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftSulfurCube.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftSulfurCube.java @@ -10,7 +10,9 @@ import net.minecraft.world.entity.item.PrimedTnt; import org.bukkit.craftbukkit.CraftRegistry; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.entity.SulfurCube; +import org.bukkit.inventory.ItemStack; public class CraftSulfurCube extends CraftAbstractCubeMob implements SulfurCube, PaperShearable, PaperBucketable { public CraftSulfurCube(final CraftServer server, final net.minecraft.world.entity.monster.cubemob.SulfurCube entity) { @@ -44,6 +46,11 @@ public boolean ignite(final boolean imminent) { return this.getHandle().primeTime(imminent); } + @Override + public boolean equipItem(final ItemStack itemStack) { + return this.getHandle().equipItem(CraftItemStack.asNMSCopy(itemStack)); + } + @Override public int getAge() { return this.getHandle().getAge();