From f64dc66a5fab51afb46a2be06017add3ca7f6f5f Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 9 Nov 2023 06:36:06 +1100 Subject: [PATCH] #1290: Add methods to get/set evoker fang attack delay By: Jishuna --- .../world/entity/projectile/EntityEvokerFangs.patch | 9 +++++++++ .../bukkit/craftbukkit/entity/CraftEvokerFangs.java | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntityEvokerFangs.patch b/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntityEvokerFangs.patch index 89000e6e43..a9d606b2eb 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntityEvokerFangs.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/projectile/EntityEvokerFangs.patch @@ -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) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEvokerFangs.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEvokerFangs.java index a95b04a1e6..885fc3b2d4 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEvokerFangs.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEvokerFangs.java @@ -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; + } }