java.lang.Object
com.pixelmonmod.pixelmon.api.spawning.AbstractSpawner
com.pixelmonmod.pixelmon.api.spawning.archetypes.spawners.TriggerSpawner

public class TriggerSpawner extends AbstractSpawner
A spawner that only does spawning when "triggered". This is a very simple implementation, and only adds a chance and helper functions for wherever the spawner is triggered. External moves and fishing are examples of areas that create and use trigger spawners, doing so without extending further.
  • Field Details

    • triggerChance

      public float triggerChance
      The chance that calling trigger(SpawnLocation) will succeed. Defaults to 1 (guaranteed trigger).
  • Constructor Details

    • TriggerSpawner

      public TriggerSpawner(String name)
    • TriggerSpawner

      public TriggerSpawner(String name, float triggerChance)
  • Method Details

    • trigger

      @Nullable public net.minecraft.world.entity.Entity trigger(SpawnLocation location)
      Triggers the spawner, causing it to check the triggerChance, attempt to find a suitable SpawnInfo, then return the created entity.
    • getAction

      public SpawnAction<? extends net.minecraft.world.entity.Entity> getAction(SpawnLocation location, float triggerChance)
      Gets SpawnAction for this location and chance, if possible. This does not spawn the entity.