Lingering Potion

Registry name

etfuturum.lingeringPotion

Basic info

  • Health: Not applicable (projectile)
  • Armor: None
  • Size: Inherited from EntityPotion (splash potion base)
  • Spawn conditions: Thrown by player using a lingering potion item
  • Drops: None (dissipates on impact)
  • Behaviour: Throwable potion that creates a lingering area-of-effect cloud on impact. Cloud applies the potion effect to all entities within range.

Impact mechanics

On onImpact(MovingObjectPosition):

  1. Spawns EntityLingeringEffect at the impact point
  2. Plays splash sound (2002 aux magic number)
  3. Marks entity as dead

Potion data

  • Stores ItemStack of the potion item (with damage value encoding the potion type)
  • Full NBT persistence: writes "Potion" compound to NBT
  • If stack is null on load → entity dies immediately

IEntityAdditionalSpawnData

  • writeSpawnData / readSpawnData: serialises the ItemStack using ByteBufUtils.writeItemStack / readItemStack
  • Used for multiplayer sync

Relationship to splash potion

  • Extends EntityPotion (splash potion entity)
  • Splash potion impacts immediately; lingering creates the effect cloud
  • The cloud entity (EntityLingeringEffect) is responsible for the actual AoE application

Notes

  • EntityPotion base handles the thrown potion physics and rendering
  • This entity only overrides the impact behavior to spawn the lingering effect cloud
  • worldObj.isRemote guard on onImpact ensures effect only spawns server-side