Class RegisterSpawnPlacementsEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.RegisterSpawnPlacementsEvent
All Implemented Interfaces:
net.neoforged.fml.event.IModBusEvent

public class RegisterSpawnPlacementsEvent extends net.neoforged.bus.api.Event implements net.neoforged.fml.event.IModBusEvent
This event allows each EntityType to have a SpawnPlacements.SpawnPredicate registered or modified. Spawn Predicates are checked whenever an Entity of the given EntityType spawns in the world naturally. If registering your own entity's spawn placements, you should use register(EntityType, SpawnPlacementType, Heightmap.Types, SpawnPlacements.SpawnPredicate, Operation) So that you ensure that your entity has a heightmap type and placement type registered. If modifying vanilla or another mod's spawn placements, you can use three operations: REPLACE: checked first, the last mod to replace the predicate wipes out all other predicates. Listen with a low EventPriority if you need to do this. OR: checked second, only one of these predicates must pass along with the original predicate AND: checked third, these predicates must all pass along with the original predicate

This event is not cancellable and does not

invalid reference
have a result
.

Fired on the Mod bus IModBusEvent.

  • Field Details

  • Constructor Details

  • Method Details

    • register

      public <T extends net.minecraft.world.entity.Entity> void register(net.minecraft.world.entity.EntityType<T> entityType, net.minecraft.world.entity.SpawnPlacements.SpawnPredicate<T> predicate)
      Register an optional spawn placement predicate for a given entityType
    • register

      public <T extends net.minecraft.world.entity.Entity> void register(net.minecraft.world.entity.EntityType<T> entityType, net.minecraft.world.entity.SpawnPlacements.SpawnPredicate<T> predicate, RegisterSpawnPlacementsEvent.Operation operation)
      Register a predicate for a given entityType with a given operation for handling
    • register

      public <T extends net.minecraft.world.entity.Entity> void register(net.minecraft.world.entity.EntityType<T> entityType, @Nullable @Nullable net.minecraft.world.entity.SpawnPlacementType placementType, @Nullable net.minecraft.world.level.levelgen.Heightmap.Types heightmap, net.minecraft.world.entity.SpawnPlacements.SpawnPredicate<T> predicate, RegisterSpawnPlacementsEvent.Operation operation)
      Register a predicate for a given entityType and operation With the option of changing the placementType and heightmap. These are only applied if RegisterSpawnPlacementsEvent.Operation.REPLACE is used. Use null for the placement or heightmap to leave them as is (which should be done in almost every case)