Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

LZDQ

Members
  • Joined

  • Last visited

Everything posted by LZDQ

  1. Hi there. Today I figured out how to send a packet of swapping two items in inventory by hovering on one and press the hotbar button of another. Clicking one is similar. First I intercept all the outgoing packets and found one called `net.minecraft.network.protocol.game.ServerboundContainerClickPacket` which does the exactly thing you wished for. Then search the source code (I get it in intellij idea's cache) and use grep to find all occurences (or you can use intellij or other IDE to grab all references but my IDEs all failed to do that) and read the code. Finally the wrapper for doing modification client-side and sending packet is `Minecraft.getInstance().gameMode.handleInventoryMouseClick`. My code here: private static void swapSlot(int slot_from, int slot_to){ // slot_from is the inventory id (for hotbar, it is [36, 45) ) // slot_to is the hotbar id [0, 9) Minecraft mc = Minecraft.getInstance(); //mc.player.sendOpenInventory(); We don't even need to open the inventory. Actually there is not a packet telling server to open inventory, only a packet of telling server to close it but we don't need it either. //Inventory inventory = mc.player.getInventory(); InventoryMenu inv_menu = mc.player.inventoryMenu; mc.gameMode.handleInventoryMouseClick( inv_menu.containerId, slot_from, slot_to, ClickType.SWAP, mc.player ); }
  2. Bro I wrote a python script to sort my slots. I send http request from java to python and sort my slots within 1s.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.