From 8fcf7cfd2dceac7b04c16c739a8ccfd7541a71db Mon Sep 17 00:00:00 2001 From: booky10 <53302036+booky10@users.noreply.github.com> Date: Fri, 12 May 2023 22:24:50 +0200 Subject: [PATCH] Added wither vanilla invulnerability API (#9124) --- patches/api/Missing-Entity-Behavior-API.patch | 29 +++++++++++++++++++ .../server/Missing-Entity-Behavior-API.patch | 6 ++++ 2 files changed, 35 insertions(+) diff --git a/patches/api/Missing-Entity-Behavior-API.patch b/patches/api/Missing-Entity-Behavior-API.patch index a0d2e41f70..0b833ba2b0 100644 --- a/patches/api/Missing-Entity-Behavior-API.patch +++ b/patches/api/Missing-Entity-Behavior-API.patch @@ -7,6 +7,7 @@ Co-authored-by: Nassim Jahnke Co-authored-by: Jake Potrebic Co-authored-by: William Blake Galbreath Co-authored-by: SoSeDiK +Co-authored-by: booky10 diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -1113,6 +1114,26 @@ diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/buk index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Wither.java +++ b/src/main/java/org/bukkit/entity/Wither.java +@@ -0,0 +0,0 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra + * Returns the wither's current invulnerability ticks. + * + * @return amount of invulnerability ticks ++ * @deprecated Duplicate api, use {@link #getInvulnerableTicks()} + */ ++ @Deprecated(forRemoval = true) // Paper + int getInvulnerabilityTicks(); + + /** +@@ -0,0 +0,0 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra + * When invulnerability ticks reach 0, the wither will trigger an explosion. + * + * @param ticks amount of invulnerability ticks ++ * @deprecated Duplicate api, use {@link #setInvulnerableTicks(int)} + */ ++ @Deprecated(forRemoval = true) // Paper + void setInvulnerabilityTicks(int ticks); + + /** @@ -0,0 +0,0 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra LEFT, RIGHT @@ -1147,6 +1168,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param value whether the wither can travel through portals + */ + void setCanTravelThroughPortals(boolean value); ++ ++ /** ++ * Makes the wither invulnerable for 11 seconds and ++ * sets the health to one third of the max health. ++ *
++ * This is called in vanilla directly after spawning the wither. ++ */ ++ void enterInvulnerabilityPhase(); + // Paper end } diff --git a/src/main/java/org/bukkit/entity/ZombieVillager.java b/src/main/java/org/bukkit/entity/ZombieVillager.java diff --git a/patches/server/Missing-Entity-Behavior-API.patch b/patches/server/Missing-Entity-Behavior-API.patch index 134a214c2a..f15a52d6d8 100644 --- a/patches/server/Missing-Entity-Behavior-API.patch +++ b/patches/server/Missing-Entity-Behavior-API.patch @@ -35,6 +35,7 @@ Co-authored-by: Nassim Jahnke Co-authored-by: Jake Potrebic Co-authored-by: William Blake Galbreath Co-authored-by: SoSeDiK +Co-authored-by: booky10 diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -1237,5 +1238,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void setCanTravelThroughPortals(boolean value) { + getHandle().setCanTravelThroughPortals(value); + } ++ ++ @Override ++ public void enterInvulnerabilityPhase() { ++ this.getHandle().makeInvulnerable(); ++ } + // Paper end }