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.

Featured Replies

Posted

Hi guys,

I need to write a method that can drop an item from a slot (like the first slot) in the player main inventory without open it.

I need it to "delete" this item from my inventory but without a replaceLike method (pick up the inventory slot and set it as Air) because I need to run this mod only on a client that need to access to a vanilla server.

So, in short, what I need to do is a process like this:

  1. open the inventory (press E);
  2. go with mouse on the selected slot;
  3. left click with mouse (pick up the item);
  4. move the mouse out of my inventory;
  5. left click with mouse (drop the item out of my inventory);
  6. close the inventory.

PS if is possible, I would like to do it without real open and close inventory, to do it in a more efficient way.

 

Anyone have an idea on how can I do it?

Thanks.

Edited by oznecniV97

  • Author
2 minutes ago, diesieben07 said:

You need to check out which packets are sent by the vanilla inventory system and then replicate those.

Sorry but, how can I do it?

 

There's a simple method to do that or I need to check manually in the Minecraft classes?

  • Author

There's a possibility to put minecraft in debug mode like an eclipse project and go ahead instruction by instruction to follow the process and verify it?

  • Author

This code works fine for the first slot in player inventory:

Minecraft mc = Minecraft.getMinecraft();
mc.playerController.windowClick(mc.player.inventoryContainer.windowId, 9, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(mc.player.inventoryContainer.windowId, -999, 0, ClickType.PICKUP, mc.player);

 

The first instruction is the left mouse click (3° param is mouse click, 0 for left, 1 for right) on the first slot in player inventory (2° param is inventory slot (0-4 for crafting, 5-8 for armor, 9-35 for inventory)).

The second instruction is the left mouse click out of inventory GUI (to drop it down).

 

This code works fine with the inventory closed.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.