Draconic Evolution

Draconic Evolution

79M Downloads

[1.20.1] `/give` command drops extra item

andriihorpenko opened this issue ยท 1 comments

commented

Base information

  • Minecraft version: 1.20.1
  • Mod version: 3.1.2.588
  • Minecraft Forge version: 47.3.10
  • Mod Pack: (if applicable)

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.
commented

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