3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00

Added wither vanilla invulnerability API (#9124)

Dieser Commit ist enthalten in:
booky10 2023-05-12 22:24:50 +02:00 committet von GitHub
Ursprung 1edfefdef8
Commit 9daa019d6c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 39 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -35,6 +35,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/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
}