Draconic Evolution

Draconic Evolution

77M Downloads

Magnet does not check if experience orb .isDead before pickup, can collect dead orbs in some cases

Lothrazar opened this issue ยท 3 comments

commented

Description

When you have two different machines or items collection experience orbs, they can get picked up twice.

For example, I have a machine that collects orbs, and calls orb.setDead();

Then the magnet tool collects them, but whats missing is

 if (orb.isDead) {
      continue;
    }

So it can collect dead orbs

Code location
https://github.com/brandon3055/Draconic-Evolution/blob/f85ad509cf7d81b4ec96f6fc6ded8b6d9c1fac22/src/main/java/com/brandon3055/draconicevolution/items/tools/Magnet.java#L122

Cross reference to the issue reported to me
Lothrazar/Cyclic#475

My code is open source as well so if you can think of anything else i can do to avoid this issue, let me know.

Base information

  • Minecraft version: 1.12.1
  • Minecraft Forge version: 14.21.1.2420
  • Mod Pack: none
commented

So my block does two things, it collects EXP orbs from world and also creates them.

Maybe its not the collection isDead as I thought, it seems like maybe when I put an exp orb in the world, the draconic magnet collects the same orb over and over and over forever. Not sure though?.

Heres my code, do i have anything weird here

https://github.com/PrinceOfAmber/Cyclic/blob/2d4bbd1c925afad942073a90a9ea5d3850ac10d5/src/main/java/com/lothrazar/cyclicmagic/component/pylonexp/TileEntityXpPylon.java#L72

commented

Will be fixed in the next release.

commented

Awesome, thanks!