Draconic-Inc / Draconic-Evolution

Other
341 stars 173 forks source link

[1.20.1] `/give` command drops extra item #1854

Open andriihorpenko opened 2 days ago

andriihorpenko commented 2 days ago

Base information

Description / steps to reproduce

So this bug is quite amusing. This is a combination of shenanigans done by Forge/Mojang, and Draconic Evolution. Whenever you /give yourself a tool, chestpiece, capacitor or dislocator - an extra item will drop on the ground and will be unpickable. I've done quite some investigation on what's happening, so here's a walkthrough:

  1. Call /give command first adds an item to player's inventory.
  2. If it was successfully added, Forge fires ItemTossEvent event, which in turn creates and spawns ItemEntity in the world.
  3. After the ItemEntity is spawned, the /give command calls ItemEntity#makeFakeItem, which forces ItemEntity to be unpickable and be immediately discarded.
  4. Now as every DE tool, chestpiece and other items have onEntityItemUpdate overridden, they call ItemEntity#setExtendedLifetime. This line makes prior fake item never disappear from the world. And, as previously mentioned, it cannot be picked up.
FoxMcloud5655 commented 2 days ago

That's... Interesting. I'll have to test this to see it myself!