Item drop duplicates

Started by Warwickslave on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Item drop duplicates
Mon, 10/13/2025 - 11:39 (edited)

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
Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
what triggers the procedure?
Mon, 10/13/2025 - 12:03

what triggers the procedure?

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Food item being eaten
Mon, 10/13/2025 - 12:10

Food item being eaten

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The random block makes both…
Mon, 10/13/2025 - 12:10

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.

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah, so in creative it…
Mon, 10/13/2025 - 12:13

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"

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
One way would be to make…
Mon, 10/13/2025 - 12:22

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,

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok, so I made it like this…
Mon, 10/13/2025 - 12:31

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