From 4a560383ae2ff6df599369d1cdd0a1a5f58f2547 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 27 Nov 2024 10:27:11 +0100 Subject: [PATCH] Fix .copyitem --- .../net/wurstclient/commands/CopyItemCmd.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/wurstclient/commands/CopyItemCmd.java b/src/main/java/net/wurstclient/commands/CopyItemCmd.java index 5c74bb10ce..f30bdeaa48 100644 --- a/src/main/java/net/wurstclient/commands/CopyItemCmd.java +++ b/src/main/java/net/wurstclient/commands/CopyItemCmd.java @@ -9,12 +9,12 @@ import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket; import net.wurstclient.command.CmdError; import net.wurstclient.command.CmdException; import net.wurstclient.command.CmdSyntaxError; import net.wurstclient.command.Command; import net.wurstclient.util.ChatUtils; +import net.wurstclient.util.CmdUtils; public final class CopyItemCmd extends Command { @@ -38,7 +38,7 @@ public void call(String[] args) throws CmdException AbstractClientPlayerEntity player = getPlayer(args[0]); ItemStack item = getItem(player, args[1]); - giveItem(item); + CmdUtils.giveItem(item); ChatUtils.message("Item copied."); } @@ -80,18 +80,4 @@ private ItemStack getItem(AbstractClientPlayerEntity player, String slot) throw new CmdSyntaxError(); } } - - private void giveItem(ItemStack stack) throws CmdError - { - int slot = MC.player.getInventory().getEmptySlot(); - if(slot < 0) - throw new CmdError("Cannot give item. Your inventory is full."); - - if(slot < 9) - slot += 36; - - CreativeInventoryActionC2SPacket packet = - new CreativeInventoryActionC2SPacket(slot, stack); - MC.player.networkHandler.sendPacket(packet); - } }