From cb34d34799cc55eec90b3bd95682d1f812e2b0af Mon Sep 17 00:00:00 2001 From: TheMode Date: Sun, 18 Apr 2021 04:35:11 +0200 Subject: [PATCH] ArgumentItemStack cleanup --- .../builder/arguments/minecraft/ArgumentItemStack.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentItemStack.java b/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentItemStack.java index 84453f644..e038998a0 100644 --- a/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentItemStack.java +++ b/src/main/java/net/minestom/server/command/builder/arguments/minecraft/ArgumentItemStack.java @@ -7,7 +7,6 @@ import net.minestom.server.item.ItemStack; import net.minestom.server.item.Material; import net.minestom.server.network.packet.server.play.DeclareCommandsPacket; import net.minestom.server.registry.Registries; -import net.minestom.server.utils.NBTUtils; import org.jetbrains.annotations.NotNull; import org.jglrxavpok.hephaistos.nbt.NBTCompound; import org.jglrxavpok.hephaistos.nbt.NBTException; @@ -40,10 +39,11 @@ public class ArgumentItemStack extends Argument { throw new ArgumentSyntaxException("The item needs a material", input, NO_MATERIAL); if (nbtIndex == -1) { - // Only item name + // Only material name final Material material = Registries.getMaterial(input); return ItemStack.of(material); } else { + // Material plus additional NBT final String materialName = input.substring(0, nbtIndex); final Material material = Registries.getMaterial(materialName); @@ -56,7 +56,7 @@ public class ArgumentItemStack extends Argument { throw new ArgumentSyntaxException("Item NBT is invalid", input, INVALID_NBT); } - return NBTUtils.loadItem(material, 1, compound); + return ItemStack.fromNBT(material, compound); } }