mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-05 16:49:39 +00:00
#876: Add missing Raider API and 'no action ticks'
This commit is contained in:
parent
0c5d870919
commit
16a083735a
2 changed files with 94 additions and 0 deletions
|
@ -271,6 +271,30 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||||
*/
|
*/
|
||||||
public void setNoDamageTicks(int ticks);
|
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.
|
* Gets the player identified as the killer of the living entity.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.bukkit.entity;
|
package org.bukkit.entity;
|
||||||
|
|
||||||
|
import org.bukkit.Raid;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -7,6 +8,35 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public interface Raider extends Monster {
|
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.
|
* Gets the block the raider is targeting to patrol.
|
||||||
*
|
*
|
||||||
|
@ -50,6 +80,46 @@ public interface Raider extends Monster {
|
||||||
*/
|
*/
|
||||||
void setCanJoinRaid(boolean join);
|
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.
|
* Get the {@link Sound} this entity will play when celebrating.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue