Class MysteryBoxEvent.Tick.TrySpawn

java.lang.Object
net.neoforged.bus.api.Event
All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
Enclosing class:
MysteryBoxEvent.Tick

public static class MysteryBoxEvent.Tick.TrySpawn extends MysteryBoxEvent.Tick implements net.neoforged.bus.api.ICancellableEvent
  • Constructor Details

    • TrySpawn

      public TrySpawn(MysteryBoxTileEntity box, net.minecraft.world.level.block.state.BlockState blockState, int chance)
      Fired before a Mystery Box tries to spawn a Pokémon. Cancelable.
      Parameters:
      box - The Mystery Box tile entity.
      blockState - The block state of this Mystery Box.
      chance - The 1/x chance of this spawn attempt occurring.
  • Method Details

    • getChance

      public int getChance()
      The 1/x chance of this spawn attempt occurring.
      Returns:
      Spawn attempt chance, 1/x.
    • setChance

      public void setChance(int chance)
      Sets the 1/x chance of this spawn attempt occurring.
      Parameters:
      chance - Spawn attempt chance, 1/x.
    • rollChance

      public boolean rollChance()
      Rolls the current spawn attempt chance.
      Returns:
      Result of rolling the current spawn attempt chance.