diff --git a/patches/api/0407-Add-No-Damage-Tick-Utilities.patch b/patches/api/0417-Add-Exact-No-Damage-Ticks-API.patch similarity index 78% rename from patches/api/0407-Add-No-Damage-Tick-Utilities.patch rename to patches/api/0417-Add-Exact-No-Damage-Ticks-API.patch index 1b850f0f61..40e60e350b 100644 --- a/patches/api/0407-Add-No-Damage-Tick-Utilities.patch +++ b/patches/api/0417-Add-Exact-No-Damage-Ticks-API.patch @@ -1,14 +1,14 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Fri, 18 Nov 2022 21:42:10 -0500 -Subject: [PATCH] Add No Damage Tick Utilities +Subject: [PATCH] Add Exact No Damage Ticks API diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 3bd1d100d0c481ae7edaa251869640ab370aeb42..a0a36c7a44ee33e0c532587e0e40d7b861c4c922 100644 +index ffca32ae2464ea5a669029079a50585ca259a4f8..e8e2284d0a841a176b883df0f4250c092e2afd3b 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -405,6 +405,7 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -467,6 +467,7 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource /** * Returns the living entity's current no damage ticks. * @@ -16,7 +16,7 @@ index 3bd1d100d0c481ae7edaa251869640ab370aeb42..a0a36c7a44ee33e0c532587e0e40d7b8 * @return amount of no damage ticks */ public int getNoDamageTicks(); -@@ -412,10 +413,39 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -474,10 +475,35 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource /** * Sets the living entity's current no damage ticks. * @@ -35,9 +35,7 @@ index 3bd1d100d0c481ae7edaa251869640ab370aeb42..a0a36c7a44ee33e0c532587e0e40d7b8 + * the exact value of how many ticks the current entity will be invulnerable. + * @return exact tick count + */ -+ default int getExactNoDamageTicks() { -+ return Math.max(0, this.getNoDamageTicks() - (this.getMaximumNoDamageTicks() / 2)); -+ } ++ int getExactNoDamageTicks(); + + /** + * Sets exactly how many ticks this entity @@ -48,9 +46,7 @@ index 3bd1d100d0c481ae7edaa251869640ab370aeb42..a0a36c7a44ee33e0c532587e0e40d7b8 + * entity invulnerable for the specified tick duration. + * @param ticks amount of ticks + */ -+ default void setExactNoDamageTicks(int ticks) { -+ this.setNoDamageTicks(ticks + (this.getMaximumNoDamageTicks() / 2)); -+ } ++ void setExactNoDamageTicks(int ticks); + // Paper end + /** diff --git a/patches/server/0977-Add-Exact-No-Damage-Ticks-API.patch b/patches/server/0977-Add-Exact-No-Damage-Ticks-API.patch new file mode 100644 index 0000000000..a4825bbc00 --- /dev/null +++ b/patches/server/0977-Add-Exact-No-Damage-Ticks-API.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Thu, 6 Apr 2023 21:11:09 -0400 +Subject: [PATCH] Add Exact No Damage Ticks API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index aec588b41f19b2147a4e7267bafa417fbcf7abc0..cb24bfc70c7e004cc951f8c056a12a2dfc8fd941 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -418,6 +418,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + public void setNoDamageTicks(int ticks) { + this.getHandle().invulnerableTime = ticks; + } ++ // Paper start ++ @Override ++ public int getExactNoDamageTicks() { ++ return Math.max(0, this.getNoDamageTicks() - (this.getMaximumNoDamageTicks() / 2)); ++ } ++ ++ @Override ++ public void setExactNoDamageTicks(int ticks) { ++ this.setNoDamageTicks(ticks + (this.getMaximumNoDamageTicks() / 2)); ++ } ++ // Paper end + + @Override + public net.minecraft.world.entity.LivingEntity getHandle() {