Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ScreenHandler screenHandler = client.player.currentScreenHandler;
- DefaultedList<Slot> defaultedList = screenHandler.slots;
- int i = defaultedList.size();
- List<ItemStack> list = Lists.newArrayListWithCapacity(i);
- for (Slot slot : defaultedList) {
- list.add(slot.getStack().copy());
- }
- Int2ObjectMap<ItemStack> int2ObjectMap = new Int2ObjectOpenHashMap<>();
- for(int slot = 0; slot < i; ++slot) {
- ItemStack itemStack = list.get(slot);
- ItemStack itemStack2 = (defaultedList.get(slot)).getStack();
- if (!ItemStack.areEqual(itemStack, itemStack2)) {
- int2ObjectMap.put(slot, itemStack2.copy());
- }
- }
- ((ClientConnectionAccessor) client.getNetworkHandler().getConnection()).getChannel().writeAndFlush(new ClickSlotC2SPacket(client.player.currentScreenHandler.syncId, client.player.currentScreenHandler.getRevision(), 0, 0, SlotActionType.QUICK_MOVE, client.player.currentScreenHandler.getCursorStack().copy(), int2ObjectMap));
Add Comment
Please, Sign In to add comment