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

This post is about version 1.12.2

I have a mod which is client side only, and I'm attempting to detect when certain things occur:

  • An item is picked up by the player
  • The inventory of a chest which was just opened
  • An item was tossed by the player
  • The player broke their tool/item
     

Currently I have forge events for:

  • PlayerEvent.ItemPickupEvent
  • PlayerDestroyItemEvent
  • ItemTossEvent
  • GuiOpenEvent


The first 3 all share the same issue.
They only fire for the server side.
The only I found exception being PlayerDestroyItemEvent when a flint and steel breaks from usage

It doesn't trigger when:

  • a shovel breaks
  • armor is destroyed
  • sheild is destroyed
  • a bow is broken
  • etc...

 

ItemTossed's only exception being when you open an inventory and drop the item by clicking outside the gui

It does not fire when the 'Drop Selected Item' key is fired (Default 'Q')

In the GuiOpenEvent I check if the gui is an instanceof GuiContainer and attempt to get its inventory.
The issue here is that the inventory isn't loaded at the time of the event.
I'm looking for a way to detect when it's done loading the data from the server packet (looks like SPacketWindowItems)

So it doesn't return an empty inventory.
Waiting an arbitrary amount of time works more or less depending on how long you wait. Trying to avoid that if possible.

Any help is appreciated
  Thanks in advanced
 -TheIncgi

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.