Class MysteryBoxEvent.Tick.TrySpawn
java.lang.Object
net.neoforged.bus.api.Event
com.pixelmonmod.pixelmon.api.events.blocks.MysteryBoxEvent
com.pixelmonmod.pixelmon.api.events.blocks.MysteryBoxEvent.Tick
com.pixelmonmod.pixelmon.api.events.blocks.MysteryBoxEvent.Tick.TrySpawn
- 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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.pixelmonmod.pixelmon.api.events.blocks.MysteryBoxEvent.Tick
MysteryBoxEvent.Tick.AboutToClose, MysteryBoxEvent.Tick.DoSpawn, MysteryBoxEvent.Tick.Start, MysteryBoxEvent.Tick.TrySpawn
Nested classes/interfaces inherited from class com.pixelmonmod.pixelmon.api.events.blocks.MysteryBoxEvent
MysteryBoxEvent.Activate, MysteryBoxEvent.ComparatorPower, MysteryBoxEvent.Feed, MysteryBoxEvent.Open, MysteryBoxEvent.Tick
-
Constructor Summary
ConstructorsConstructorDescriptionTrySpawn
(MysteryBoxTileEntity box, net.minecraft.world.level.block.state.BlockState blockState, int chance) Fired before a Mystery Box tries to spawn a Pokémon. -
Method Summary
Modifier and TypeMethodDescriptionint
The 1/x chance of this spawn attempt occurring.boolean
Rolls the current spawn attempt chance.void
setChance
(int chance) Sets the 1/x chance of this spawn attempt occurring.Methods inherited from class com.pixelmonmod.pixelmon.api.events.blocks.MysteryBoxEvent
getBlockState, getBox
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
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.
-