Skip to content

Commit

Permalink
Fix .copyitem
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Nov 27, 2024
1 parent 8d0d39d commit 4a56038
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/main/java/net/wurstclient/commands/CopyItemCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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.");
}
Expand Down Expand Up @@ -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);
}
}

0 comments on commit 4a56038

Please sign in to comment.