Jump to content

Forge Events, Client side only


TheIncgi

Recommended Posts

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

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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