Mojira Archive
MC-114260

Entity duplication with portals

The bug

When an entity dies while travelling through a portal, it will drop its items and travel to the dimension.

This can further be exploited as a method of mass duplicating items.

Suggested fix

Provided by Marcono1234

The following changes should be made to fix the issue

  1. Override setDead in EntityLivingBase to set the boolean dead to true as well
  2. Methods overriding onDeath need to test for dead as well or add an onDeathSpecial method which is called in EntityLivingBase.onDeath and then overridden
  3. (Optional but suggested): Write dead as DeathHandled to NBT to make sure that onDeath runs only once even after reloading or teleporting to another dimension

This would require EntitySlime.onUpdate() to call setDead() as well and not directly set the field value.

Note - The boolean dead found in EntityLivingBase that returns true when the entity begins its death animation and has 0 health; not the boolean isDead in the Entity class.