Class MysteryBoxEvent.Tick.TrySpawn
java.lang.Object
net.minecraftforge.eventbus.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
- Enclosing class:
- MysteryBoxEvent.Tick
-
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
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Constructor Summary
ConstructorDescriptionTrySpawn
(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 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
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.
-