Added wither vanilla invulnerability API (#9124)

This commit is contained in:
booky10 2023-05-12 22:24:50 +02:00 committed by GitHub
parent 1edfefdef8
commit 9daa019d6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 4 deletions

View file

@ -7,6 +7,7 @@ Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
Co-authored-by: booky10 <boooky10@gmail.com>
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