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

In 1.15 and before, you could get the item being held/dragged by the cursor using PlayerInventory#getItemStack. This no longer seems to be the case. How do we do this now?

It's still there with the same name, if you are using 1.16 MCP mappings.

Otherwise it will be AbstractContainerMenu#getCarried.

Edited by poopoodice

  • Author

Thank you! I did notice AbstractContainerMenu#getCarried and was able use that.

Sorry, I am maintaining my mods in 1.16.5, 1.17.1 and 1.18 right now, and I just noticed that PlayerInventory#getItemStack does indeed exist in 1.16.5 but not 1.17.1 which doesn't have PlayerInventory at all, just Inventory which does not have getItemStack.

My title should have said 1.17.1+. Sorry for the confusion.

  • Author
4 hours ago, diesieben07 said:

1.17 uses Mojang names, not MCP names.

Good to know, so is there a PlayerInventory#getItemStack equivalent in the Mojang mappings, or is AbstractContainerMenu#getCarried the way to go?

I don't actually need to know at this point, and I'm not sure of any scenario where you'd need it and not have a container menu available. I'm just curious and also wondering for the benefit of someone else with the same question who finds this post.

  • Danny and Son changed the title to Get Item held by cursor in 1.17.1+

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.