Guest User

Untitled

a guest
Apr 4th, 2022
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1.             ScreenHandler screenHandler = client.player.currentScreenHandler;
  2.             DefaultedList<Slot> defaultedList = screenHandler.slots;
  3.             int i = defaultedList.size();
  4.             List<ItemStack> list = Lists.newArrayListWithCapacity(i);
  5.  
  6.             for (Slot slot : defaultedList) {
  7.                 list.add(slot.getStack().copy());
  8.             }
  9.  
  10.             Int2ObjectMap<ItemStack> int2ObjectMap = new Int2ObjectOpenHashMap<>();
  11.  
  12.             for(int slot = 0; slot < i; ++slot) {
  13.                 ItemStack itemStack = list.get(slot);
  14.                 ItemStack itemStack2 = (defaultedList.get(slot)).getStack();
  15.                 if (!ItemStack.areEqual(itemStack, itemStack2)) {
  16.                     int2ObjectMap.put(slot, itemStack2.copy());
  17.                 }
  18.             }
  19.  
  20.             ((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));
  21.            
Add Comment
Please, Sign In to add comment