SPIGOT-7732: Issue with the "hurt()" method of EntityLiving and invulnerable time

By: LoliColleen <76620594+LoliColleen@users.noreply.github.com>
This commit is contained in:
CraftBukkit/Spigot
2024-06-22 18:46:41 +10:00
parent 7667932681
commit aef018b9c4
7 changed files with 291 additions and 226 deletions

View File

@@ -1,6 +1,17 @@
--- a/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
@@ -141,7 +141,7 @@
@@ -50,6 +50,10 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityDamageEvent;
+// CraftBukkit end
+
public class Camel extends EntityHorseAbstract implements IJumpable, ISaddleable {
public static final float BABY_SCALE = 0.45F;
@@ -141,7 +145,7 @@
@Override
protected void customServerAiStep() {
this.level().getProfiler().push("camelBrain");
@@ -9,21 +20,21 @@
behaviorcontroller.tick((WorldServer) this.level(), this);
this.level().getProfiler().pop();
@@ -452,9 +452,15 @@
@@ -452,9 +456,15 @@
}
@Override
- protected void actuallyHurt(DamageSource damagesource, float f) {
+ // CraftBukkit start - void -> boolean
+ public boolean actuallyHurt(DamageSource damagesource, float f) {
+ boolean hurt = super.actuallyHurt(damagesource, f);
+ if (!hurt) {
+ return hurt;
+ public boolean actuallyHurt(DamageSource damagesource, float f, EntityDamageEvent event) {
+ boolean damageResult = super.actuallyHurt(damagesource, f, event);
+ if (!damageResult) {
+ return false;
+ }
+ // CraftBukkit end
this.standUpInstantly();
- super.actuallyHurt(damagesource, f);
+ return hurt; // CraftBukkit
+ return true; // CraftBukkit
}
@Override