Package com.pixelmonmod.pixelmon.battles
Class BattleRegistry
java.lang.Object
com.pixelmonmod.pixelmon.battles.BattleRegistry
Keeps track of all active battles.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Removes a battle from the battle list.static BattleController
Finds a battle from its index.static BattleController
getBattle
(net.minecraft.world.entity.Entity player) Finds the battle a player is in.static boolean
inBattle
(net.minecraft.world.entity.Entity entity) Checks if an entity is in a battle.static boolean
performPreBattleChecksAndEvents
(BattleController controller, BattleParticipant[] teamOne, BattleParticipant[] teamTwo) static void
Registers a battle in the battle list.static void
registerSpectator
(net.minecraft.server.level.ServerPlayer spectator, BattleController bc) Registers a spectator in a battle.static void
unregisterSpectator
(net.minecraft.server.level.ServerPlayer spectator) Unregisters a spectator from a battle.static void
-
Method Details
-
performPreBattleChecksAndEvents
public static boolean performPreBattleChecksAndEvents(BattleController controller, BattleParticipant[] teamOne, BattleParticipant[] teamTwo) -
registerBattle
Registers a battle in the battle list.- Parameters:
bc
- The battle to register.
-
getBattle
Finds a battle from its index.- Parameters:
index
- The index of the battle to find.- Returns:
- The battle with the given index, or null if none are found.
-
getBattle
Finds the battle a player is in.- Parameters:
player
- The player to find a battle for.- Returns:
- The battle the player is in, or null if the player is not in a battle.
-
inBattle
public static boolean inBattle(net.minecraft.world.entity.Entity entity) Checks if an entity is in a battle.- Parameters:
entity
- The entity to check.- Returns:
- True if the entity is in a battle, false otherwise.
-
registerSpectator
@Internal public static void registerSpectator(net.minecraft.server.level.ServerPlayer spectator, BattleController bc) Registers a spectator in a battle.
You should not be using this method directly. UseBattleController.spectate(ServerPlayer, Entity)
instead.- Parameters:
spectator
- The spectator to register.bc
- The battle to register the spectator to.
-
unregisterSpectator
@Internal public static void unregisterSpectator(net.minecraft.server.level.ServerPlayer spectator) Unregisters a spectator from a battle.
You should not be using this method directly. UseBattleController.removeSpectator(ServerPlayer)
instead.- Parameters:
spectator
- The spectator to unregister.
-
deRegisterBattle
Removes a battle from the battle list.- Parameters:
bc
- The battle to remove.
-
updateBattles
public static void updateBattles()
-