#1290: Add methods to get/set evoker fang attack delay

By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2023-11-09 06:36:06 +11:00
parent 80d3f8408a
commit f64dc66a5f
2 changed files with 22 additions and 0 deletions

View file

@ -1,5 +1,14 @@
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
@@ -19,7 +19,7 @@
public static final int ATTACK_DURATION = 20;
public static final int LIFE_OFFSET = 2;
public static final int ATTACK_TRIGGER_TICKS = 14;
- private int warmupDelayTicks;
+ public int warmupDelayTicks;
private boolean sentSpikeEvent;
private int lifeTicks;
private boolean clientSideAttackStarted;
@@ -129,7 +129,9 @@
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {

View file

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.entity.projectile.EntityEvokerFangs;
import org.bukkit.craftbukkit.CraftServer;
@ -33,4 +34,16 @@ public class CraftEvokerFangs extends CraftEntity implements EvokerFangs {
public void setOwner(LivingEntity owner) {
getHandle().setOwner(owner == null ? null : ((CraftLivingEntity) owner).getHandle());
}
@Override
public int getAttackDelay() {
return getHandle().warmupDelayTicks;
}
@Override
public void setAttackDelay(int delay) {
Preconditions.checkArgument(delay >= 0, "Delay must be positive");
getHandle().warmupDelayTicks = delay;
}
}