Posted August 22, 20187 yr I'm writing a client side mod. I would like to run codes when a player pickup an item. I have tested the following net.minecraftforge.event.entity.player.EntityItemPickupEvent 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. I failed to find the correct event to handle the event in the library. 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 August 22, 20187 yr by anonymous2
August 22, 20187 yr Author Thus, I should check player inventory periodically and compute the difference?
August 23, 20187 yr 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 Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
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.