Interface DragonBattle
public interface DragonBattle
Represents a dragon battle state for a world with an end environment.
- Since:
- 1.15.2
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumRepresents a phase in the dragon respawn process. -
Method Summary
Modifier and TypeMethodDescriptionbooleangenerateEndPortal(boolean withPortals) Generate the end portal.@NotNull BossBarGet the boss bar to be displayed for this dragon battle.@Nullable EnderDragonGet theEnderDragonactive in this battle.@Nullable LocationGet the location of the end portal.intGets the number of gateways tracked by this DragonBattle.@NotNull @Unmodifiable List<EnderCrystal> Gets theEnderCrystals on top of the pillars that heal the dragon.@NotNull @Unmodifiable List<EnderCrystal> Gets theEnderCrystals being used to respawn the dragon.@NotNull DragonBattle.RespawnPhaseGet this battle's current respawn phase.booleanCheck whether the first dragon has been killed already.voidTry to initiate a respawn sequence to summon the dragon as though a player has placed 4 end crystals on the portal.booleaninitiateRespawn(@Nullable Collection<EnderCrystal> crystals) Try to initiate a respawn sequence to summon the dragon.voidReset the crystals located on the obsidian pillars (remove their beam targets and invulnerability).voidsetPreviouslyKilled(boolean previouslyKilled) Sets whether the first dragon has been killed already.booleansetRespawnPhase(@NotNull DragonBattle.RespawnPhase phase) Set the dragon's respawn phase.booleanTries to spawn a new end gateway using default game mechanics.voidspawnNewGateway(Position position) Spawns a new end gateway at the specified position.
-
Method Details
-
getEnderDragon
Get theEnderDragonactive in this battle.
Will return null if the dragon has been slain.- Returns:
- the ender dragon. null if dead
- Since:
- 1.15.2
-
getBossBar
Get the boss bar to be displayed for this dragon battle.- Returns:
- the boss bar
- Since:
- 1.15.2
-
getEndPortalLocation
Get the location of the end portal.
This location will be at the center of the base (bottom) of the portal.- Returns:
- the end portal location or null if not generated
- Since:
- 1.15.2
-
generateEndPortal
boolean generateEndPortal(boolean withPortals) Generate the end portal.- Parameters:
withPortals- whether end portal blocks should be generated- Returns:
- true if generated, false if already present
- Since:
- 1.16.1
-
hasBeenPreviouslyKilled
boolean hasBeenPreviouslyKilled()Check whether the first dragon has been killed already.- Returns:
- true if killed before, false otherwise
- Since:
- 1.15.2
-
setPreviouslyKilled
void setPreviouslyKilled(boolean previouslyKilled) Sets whether the first dragon has been killed already.
If the dragon has not previously been killed, a portal will be generated when it is finally killed.- Parameters:
previouslyKilled- true if the dragon has been killed before, false otherwise- Since:
- 1.20.4
-
initiateRespawn
void initiateRespawn()Try to initiate a respawn sequence to summon the dragon as though a player has placed 4 end crystals on the portal.- Since:
- 1.15.2
-
initiateRespawn
Try to initiate a respawn sequence to summon the dragon.- Parameters:
crystals- theEnderCrystalsto use in the respawn, or a null or empty list to render the respawn sequence uncancellable. null entries or crystals that do not reside in the same world as this dragon battle will be ignored.- Returns:
- true if the respawn was initiated, false otherwise.
- Since:
- 1.20.1
-
getRespawnPhase
Get this battle's current respawn phase.- Returns:
- the current respawn phase.
- Since:
- 1.15.2
-
setRespawnPhase
Set the dragon's respawn phase.
This method will is unsuccessful if a dragon respawn is not in progress.- Parameters:
phase- the phase to set- Returns:
- true if successful, false otherwise
- Since:
- 1.15.2
- See Also:
-
resetCrystals
void resetCrystals()Reset the crystals located on the obsidian pillars (remove their beam targets and invulnerability).- Since:
- 1.15.2
-
getGatewayCount
int getGatewayCount()Gets the number of gateways tracked by this DragonBattle. This starts out at 0 and will increase to 20, once for each kill of theEnderDragon.- Returns:
- the number of gateways around the end island tracked by this
- Since:
- 1.20.1
-
spawnNewGateway
boolean spawnNewGateway()Tries to spawn a new end gateway using default game mechanics.- Returns:
- true if successful, false if there is already the maximum.
- Since:
- 1.20.1
-
spawnNewGateway
Spawns a new end gateway at the specified position. This will spawn regardless of the number of gateways already present.- Parameters:
position- position for the new gateway- Since:
- 1.20.1
-
getRespawnCrystals
@NotNull @Unmodifiable List<EnderCrystal> getRespawnCrystals()Gets theEnderCrystals being used to respawn the dragon. If no respawn is ongoing, the list will be empty.- Returns:
- the respawn crystals
- Since:
- 1.20.1
-
getHealingCrystals
@NotNull @Unmodifiable List<EnderCrystal> getHealingCrystals()Gets theEnderCrystals on top of the pillars that heal the dragon.- Returns:
- the healing crystals
- Since:
- 1.20.1
-