Jump to content

[closed] Player pickup item event on Client - forge: 2705


anonymous2

Recommended Posts

I'm writing a client side mod. I would like to run codes when a player pickup an item.

I have tested the following

  1. net.minecraftforge.event.entity.player.EntityItemPickupEvent
  2. net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemPickupEvent

both not work when I connect to a server, but work on singleplayer.

I suppose these 2 functions are logical server stuff, how can I run codes when a player pickup an item?

Moreover, what is the difference between above 2 class?

 

Because I don't know how Minecraft internal works, I have 2 assumptions.

  1. I failed to find the correct event to handle the event in the library.
  2. Minecraft server doesn't have a mechanism to notice client when a player pickup an item. Instead the server sends packets to client: The EntityItem disappear, update player inventory (picked up an item).
Edited by anonymous2
Link to comment
Share on other sites

Couldn’t you look at the animation on itemstacks? If I remember correctly the animation only gets shown if you pick up an item, and not if you click or shift click it from another inventory. It’s probably going to be pretty deep in vanilla code, but it seems more efficient than keeping a copy of the inventory

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.