#876: Add missing Raider API and 'no action ticks'

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
Bukkit/Spigot 2023-06-23 09:58:54 +10:00
parent ebacd66617
commit 47eb380e95
2 changed files with 94 additions and 0 deletions

View file

@ -271,6 +271,30 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*/
public void setNoDamageTicks(int ticks);
/**
* Get the ticks that this entity has performed no action.
* <p>
* The details of what "no action ticks" entails varies from entity to entity
* and cannot be specifically defined. Some examples include squid using this
* value to determine when to swim, raiders for when they are to be expelled
* from raids, or creatures (such as withers) as a requirement to be despawned.
*
* @return amount of no action ticks
*/
public int getNoActionTicks();
/**
* Set the ticks that this entity has performed no action.
* <p>
* The details of what "no action ticks" entails varies from entity to entity
* and cannot be specifically defined. Some examples include squid using this
* value to determine when to swim, raiders for when they are to be expelled
* from raids, or creatures (such as withers) as a requirement to be despawned.
*
* @param ticks amount of no action ticks
*/
public void setNoActionTicks(int ticks);
/**
* Gets the player identified as the killer of the living entity.
* <p>

View file

@ -1,5 +1,6 @@
package org.bukkit.entity;
import org.bukkit.Raid;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.jetbrains.annotations.NotNull;
@ -7,6 +8,35 @@ import org.jetbrains.annotations.Nullable;
public interface Raider extends Monster {
/**
* Set the {@link Raid} that this raider is participating in.
*
* @param raid the raid to set
*/
void setRaid(@Nullable Raid raid);
/**
* Get the {@link Raid} that this raider is participating in, if any.
*
* @return the raid, or null if not participating in a raid
*/
@Nullable
Raid getRaid();
/**
* Get the raid wave that this raider spawned as part of.
*
* @return the raid wave, or 0 if not participating in a raid
*/
int getWave();
/**
* Set the raid wave that this raider was spawned as part of.
*
* @param wave the raid wave to set. Must be >= 0
*/
void setWave(int wave);
/**
* Gets the block the raider is targeting to patrol.
*
@ -50,6 +80,46 @@ public interface Raider extends Monster {
*/
void setCanJoinRaid(boolean join);
/**
* Get the amount of ticks that this mob has exited the bounds of a village
* as a raid participant.
* <p>
* This value is increased only when the mob has had no action for 2,400 ticks
* (according to {@link #getNoActionTicks()}). Once both the no action ticks have
* reached that value and the ticks outside a raid exceeds 30, the mob will be
* expelled from the raid.
*
* @return the ticks outside of a raid
*/
int getTicksOutsideRaid();
/**
* Set the amount of ticks that this mob has exited the bounds of a village
* as a raid participant.
* <p>
* This value is considered only when the mob has had no action for 2,400 ticks
* (according to {@link #getNoActionTicks()}). Once both the no action ticks have
* reached that value and the ticks outside a raid exceeds 30, the mob will be
* expelled from the raid.
*
* @param ticks the ticks outside of a raid
*/
void setTicksOutsideRaid(int ticks);
/**
* Check whether or not this raider is celebrating a raid victory.
*
* @return true if celebrating, false otherwise
*/
boolean isCelebrating();
/**
* Set whether or not this mob is celebrating a raid victory.
*
* @param celebrating whether or not to celebrate
*/
void setCelebrating(boolean celebrating);
/**
* Get the {@link Sound} this entity will play when celebrating.
*