Started by
Warwickslave
on
Topic category: Help with Minecraft modding (Java Edition)
Hi, I have an issue with item drop. So, I have a food item which when eaten has a small chance to drop certain item. But when this occurs, sometimes item drops twice.
(There is no issue with dropping golden ingot, but the music disc drops twice)
Also it worked fine until I added "wait 40 ticks" block
Here's the code
https://imgur.com/a/dYtIi1s
Edited by Warwickslave on Mon, 10/13/2025 - 11:39
what triggers the procedure?
Food item being eaten
The random block makes both the client and the server roll independently, so the server might get to the random block and roll 0.9213213 but the client will get 0.0123234.
Since the totem-like animation block is client-sided but the wait block is server-sided they should be out of sync. You might have the animation show but not get the item or get the item and not have the animation show.
But this should still be true without the wait block, did you test it in creative mode? In survival the client can't give itself items, that aren't just ghost items anyway.
Yeah, so in creative it gives me an item, in survival its a ghost. What can I do to solve this problem?
I need an item being given after the "totem animation"
One way would be to make sure only the server rolls random number,
and then you can set a global variable on the player to have them play the animation,
try this,
then in a different procedure,
Ok, so I made it like this and it seems to work. Is it correct or can cause some other issues? (maybe when playing on a server)
https://imgur.com/a/O1eFiEn
you should do it like I showed,
doing it like this https://imgur.com/a/O1eFiEn should still cause,