Interface EntitySpawnCallback.Pre

Enclosing class:
EntitySpawnCallback
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface EntitySpawnCallback.Pre
Callback for before the entity spawns. Use this to cancel, force succeed, or alter the entity spawning.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.InteractionResult
    onEntitySpawnPre(net.minecraft.world.entity.Entity original, AtomicReference<net.minecraft.world.entity.Entity> entity, net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.entity.MobSpawnType reason)
     
  • Method Details

    • onEntitySpawnPre

      net.minecraft.world.InteractionResult onEntitySpawnPre(net.minecraft.world.entity.Entity original, AtomicReference<net.minecraft.world.entity.Entity> entity, net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.entity.MobSpawnType reason)
      Parameters:
      original - the entity that was originally going to spawn.
      entity - the entity that is going to spawn. If this is different to original, then a mod has modified the entity to spawn.
      world - the world in which the entity is to spawn.
      reason - the cause of the spawning.
      Returns:
      • SUCCESS or CONSUME to instantly succeed in spawning the entity in the world at its specified position.
      • PASS to leave SUCCESS/FAIL handling to subsequent events. If all events PASS, the action is determined to be a SUCCESS.
      • FAIL cancel spawning the entity.