diff options
author | booky10 <[email protected]> | 2023-05-12 22:24:50 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2023-05-12 15:24:50 -0500 |
commit | 9daa019d6c0b03f18c57a995f6ca24aaa32f5a5a (patch) | |
tree | 33019205fbb09283cc7d7f3733a9b536e9ceadff | |
parent | 1edfefdef86ebd90edbf88d77ef4623de432b670 (diff) | |
download | Paper-9daa019d6c0b03f18c57a995f6ca24aaa32f5a5a.tar.gz Paper-9daa019d6c0b03f18c57a995f6ca24aaa32f5a5a.zip |
Added wither vanilla invulnerability API (#9124)
-rw-r--r-- | patches/api/0300-Missing-Entity-Behavior-API.patch | 33 | ||||
-rw-r--r-- | patches/server/0645-Missing-Entity-Behavior-API.patch | 10 |
2 files changed, 39 insertions, 4 deletions
diff --git a/patches/api/0300-Missing-Entity-Behavior-API.patch b/patches/api/0300-Missing-Entity-Behavior-API.patch index e16a4990e6..12baa90a91 100644 --- a/patches/api/0300-Missing-Entity-Behavior-API.patch +++ b/patches/api/0300-Missing-Entity-Behavior-API.patch @@ -7,6 +7,7 @@ Co-authored-by: Nassim Jahnke <[email protected]> Co-authored-by: Jake Potrebic <[email protected]> Co-authored-by: William Blake Galbreath <[email protected]> Co-authored-by: SoSeDiK <[email protected]> +Co-authored-by: booky10 <[email protected]> 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 dddbb661265aa23f88d93d0681f418f40a872351..998f629852e1103767e005405d1f39c2251ecd28 100644 @@ -1110,10 +1111,30 @@ index 3794db8867b53f3b3735ad82fdd8765a26df2bfb..efaa45f41bc1dc8df6665c55b4e5ade3 * Increases the anger level of this warden. * diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java -index 87a814f63c3f35be35bfa210c9248ad211c0dd8f..bc6161989876e615085ab54715f35451a2f942bb 100644 +index 87a814f63c3f35be35bfa210c9248ad211c0dd8f..14543c2238b45c526dd9aebea2aa5c22f5df54dc 100644 --- a/src/main/java/org/bukkit/entity/Wither.java +++ b/src/main/java/org/bukkit/entity/Wither.java -@@ -64,4 +64,35 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra +@@ -43,7 +43,9 @@ 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(); + + /** +@@ -52,7 +54,9 @@ 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); + + /** +@@ -64,4 +68,43 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra LEFT, RIGHT } @@ -1147,6 +1168,14 @@ index 87a814f63c3f35be35bfa210c9248ad211c0dd8f..bc6161989876e615085ab54715f35451 + * @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. ++ * <br> ++ * 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/0645-Missing-Entity-Behavior-API.patch b/patches/server/0645-Missing-Entity-Behavior-API.patch index 554fac3e32..4ecfa04de0 100644 --- a/patches/server/0645-Missing-Entity-Behavior-API.patch +++ b/patches/server/0645-Missing-Entity-Behavior-API.patch @@ -35,6 +35,7 @@ Co-authored-by: Nassim Jahnke <[email protected]> Co-authored-by: Jake Potrebic <[email protected]> Co-authored-by: William Blake Galbreath <[email protected]> Co-authored-by: SoSeDiK <[email protected]> +Co-authored-by: booky10 <[email protected]> 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 f80a6ad7638453348ee82ea00b166a3aac029142..a08c00b8c0488d18be5e182f7892e5ab71d12247 100644 @@ -1204,10 +1205,10 @@ index 08c55cb00c8ff3c39dd99c64227d5d60abee2a51..6ecdc4bf1f6b8f0363e667135ba46343 public void increaseAnger(Entity entity, int increase) { Preconditions.checkArgument(entity != null, "Entity cannot be null"); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java -index 8c32f70ec0defa5c67f2d02d13116e27de5de76d..dab37db550a33a18f02d2404a4d6f44db7d1322b 100644 +index 8c32f70ec0defa5c67f2d02d13116e27de5de76d..1a21d30620f13a48976da5ead7edab201ea68b21 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java -@@ -73,4 +73,31 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok +@@ -73,4 +73,36 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok this.getHandle().setInvulnerableTicks(ticks); } @@ -1237,5 +1238,10 @@ index 8c32f70ec0defa5c67f2d02d13116e27de5de76d..dab37db550a33a18f02d2404a4d6f44d + public void setCanTravelThroughPortals(boolean value) { + getHandle().setCanTravelThroughPortals(value); + } ++ ++ @Override ++ public void enterInvulnerabilityPhase() { ++ this.getHandle().makeInvulnerable(); ++ } + // Paper end } |