From 7fae70ebc10a955bbf847d6b168dd652df7c603f Mon Sep 17 00:00:00 2001 From: TheMode Date: Fri, 23 Jul 2021 01:47:43 +0200 Subject: [PATCH] Add experimental ItemStack#consume --- src/main/java/net/minestom/server/item/ItemStack.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/net/minestom/server/item/ItemStack.java b/src/main/java/net/minestom/server/item/ItemStack.java index cf511cbe8..3ce0aeeec 100644 --- a/src/main/java/net/minestom/server/item/ItemStack.java +++ b/src/main/java/net/minestom/server/item/ItemStack.java @@ -7,6 +7,7 @@ import net.minestom.server.item.rule.VanillaStackingRule; import net.minestom.server.tag.Tag; import net.minestom.server.tag.TagReadable; import net.minestom.server.utils.NBTUtils; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -105,6 +106,12 @@ public final class ItemStack implements TagReadable, HoverEventSource currentAmount - amount); + } + @Contract(value = "_, _ -> new", pure = true) public > @NotNull ItemStack withMeta(Class metaType, Consumer metaConsumer) { return builder().meta(metaType, metaConsumer).build();