Fabric API

Fabric API

108M Downloads

ClientPlayerEntity#dropItem() not dropping anything

INeedAwesome opened this issue ยท 3 comments

commented

Hello!
Im trying to make a mod (mostly for myself) where I can throw all of my ender pearls out of my inventory when i press a button (U).
I have noticed that ClientPlayerEntity#dropItem() does not work, and I want to know how I throw stuff out of the inventory. As I don't find a way.
What's happening is that my arm swings but that's it. What I expect it to do is drop the item like pressing the q button.

My mod is developed client side. Github repo and the file is available.
What am I doing wrong?

commented

This area is for bug reports of the fabric api.
If you want help, please use the discussions tab or the fabric discord.

Anyway, at first glance:
https://github.com/INeedAwesome/Julkinen/blob/a7fcfcdba940e6364da4b7adde43ae239b6d7fc4/src/main/java/site/gr8/mattis/ThrowEnderPearls.java#L18
Shouldn't this be "Ender Pearl", not "ender pearl"?
It would be better to use stack.getItem() == Items.ENDER_PEARL because different languages.

commented

I also think dropItem() is probably the wrong method on the client. The client method should be only used in response to events happening on the server when dropItem() is invoked on the ServerPlayerEntity?
Compare with the "q key" method that uses dropSelectedItem() which actually sends messages to the server, i.e. it initiates the event.

commented

๐Ÿ‘‹ We use the issue tracker exclusively for final bug reports and feature requests. However, this issue appears to be better suited for either a discussion thread, or a message on our discord server. Please post your request on one of these, and the conversation can continue there.