Event That Fired When the Player Pickups An Arrow From Ground?

9 posts in this topic

Hello everyone. I'm stuck at somewhere in modding. I need to customize the arrow drop (getting the arrow back from the ground you shot). All i want is; the EntityArrow on the ground gives Broken Arrow(my mod item) by a chance instead of Arrow item from vanilla. Isn't it possible to do?

I looked into LivingDropsEvent, EntityItemPickupEvent and ItemPickupEvent but i couldn't find a way to do it. These events fired only when the player pickups an arrow as an item(dropped item) from the ground. Help me please

Share this post

Link to post

Share on other sites

You can still do it but would require doing something a bit intrusive. For example, one approach is to replace all EntityArrow with your own version that extends EntityArrow and overrides the collision method.

Another approach would be to set the public pickupStatus field in every EntityArrow to EntityArrow.PickupStatus.DISALLOWED and then handle the entity update event and process the collision yourself.

Share this post

Link to post

Share on other sites

You can still do it but would require doing something a bit intrusive. For example, one approach is to replace all EntityArrow with your own version that extends EntityArrow and overrides the collision method.

Another approach would be to set the public pickupStatus field in every EntityArrow to EntityArrow.PickupStatus.DISALLOWED and then handle the entity update event and process the collision yourself.

Could you also use reflection to replace that bit of code that handles pickups in EntityArrow with your code?

Which problem?
So you are using ClientCommandHandler for your command?
You say "I just removed the Runnable thing" and then you say "the first time I do a Runnable...". Please clarify. Post updated code, ideally.
99% this is caused by you opening the GUI from a different thread than the client main thread.

Uhm no I started to rename the buttonId starting by 0, 1 and so on and that fixed the problem. And I'm doing all this on client side, I just removed the Runnable thing now while opening the GUI and it works fine. Correct me if I am wrong although the program seems to run fine. When opening the GUI the first time I do Runnable a add a tick to open the GUI so to not crash but later on as I'm jumping from screen to screen it does not do that.
And can you reply a solution to this as well along with your reply to this reply, "When I open the gui i have no rendered cursor, it only shows up when i move my mouse outside of the minecraft window and move it back in. Fix for this. @diesieben07"