Class CustomPhase
java.lang.Object
me.gamercoder215.mobchip.ai.enderdragon.CustomPhase
- All Implemented Interfaces:
DragonPhase
,Keyed
Represents a custom Ender Dragon Phase.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EnderDragon
The Dragon that this phase is attached to.protected final NamespacedKey
The unique ID of this phase. -
Constructor Summary
ConstructorsConstructorDescriptionCustomPhase
(@NotNull EnderDragon dragon, @NotNull NamespacedKey key) Constructs a new CustomPhase. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called every tick during the phase between the first and last.final @NotNull EnderDragon
Fetches the Dragon associated with this Custom Phase.float
Fetches the current flying speed of the dragon.final @NotNull NamespacedKey
getKey()
Fetches the unique ID of this phase.boolean
Whether the Ender Dragon is currently sitting.void
Called when an End Crystal is destroyed during this phase.float
onDamage
(EntityDamageEvent.DamageCause cause, float amount) Called when the Dragon is damaged during this phase.void
Called every tick during the phase between the first and last.void
start()
Called when the Phase starts on the first tick.void
stop()
Called when the Phase ends on the last tick.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.gamercoder215.mobchip.ai.enderdragon.DragonPhase
getTargetLocation
-
Field Details
-
dragon
The Dragon that this phase is attached to. -
key
The unique ID of this phase.
-
-
Constructor Details
-
CustomPhase
public CustomPhase(@NotNull @NotNull EnderDragon dragon, @NotNull @NotNull NamespacedKey key) throws IllegalArgumentException Constructs a new CustomPhase.- Parameters:
dragon
- Ender Dragon to use.key
- The unique ID of this phase.- Throws:
IllegalArgumentException
- if dragon or key is null
-
-
Method Details
-
getKey
Fetches the unique ID of this phase. -
getDragon
Description copied from interface:DragonPhase
Fetches the Dragon associated with this Custom Phase.- Specified by:
getDragon
in interfaceDragonPhase
- Returns:
- EnderDragon used in this phase
-
stop
public void stop()Description copied from interface:DragonPhase
Called when the Phase ends on the last tick.- Specified by:
stop
in interfaceDragonPhase
-
start
public void start()Description copied from interface:DragonPhase
Called when the Phase starts on the first tick.- Specified by:
start
in interfaceDragonPhase
-
serverTick
public void serverTick()Description copied from interface:DragonPhase
Called every tick during the phase between the first and last.
Use this method to handle server logic (e.g. movements).- Specified by:
serverTick
in interfaceDragonPhase
-
clientTick
public void clientTick()Description copied from interface:DragonPhase
Called every tick during the phase between the first and last.
Use this method to handle client logic (e.g. packets, particles).- Specified by:
clientTick
in interfaceDragonPhase
-
onCrystalDestroyed
public void onCrystalDestroyed(EnderCrystal c, EntityDamageEvent.DamageCause cause, @Nullable @Nullable Player p) Description copied from interface:DragonPhase
Called when an End Crystal is destroyed during this phase.- Specified by:
onCrystalDestroyed
in interfaceDragonPhase
- Parameters:
c
- Crystal Destroyedcause
- Damage Cause that destroyed the Crystalp
- Player that destroyed the crystal, can be null
-
onDamage
Description copied from interface:DragonPhase
Called when the Dragon is damaged during this phase.- Specified by:
onDamage
in interfaceDragonPhase
- Parameters:
cause
- Damage Cause that damaged the Dragonamount
- Amount of damage that was dealt- Returns:
- the new damage amount
-
isSitting
public boolean isSitting()Description copied from interface:DragonPhase
Whether the Ender Dragon is currently sitting.- Specified by:
isSitting
in interfaceDragonPhase
- Returns:
- true if sitting, else false
-
getFlyingSpeed
public float getFlyingSpeed()Description copied from interface:DragonPhase
Fetches the current flying speed of the dragon. Defaults to 0.6F.- Specified by:
getFlyingSpeed
in interfaceDragonPhase
- Returns:
- Flying Speed
-