Commits

md_5 authored e95450221f3
SPIGOT-7999: ConcurrentModificationException in EntityLiving#hurtServer
No tags

nms-patches/net/minecraft/world/entity/EntityLiving.patch

Modified
509 509
510 510 @@ -1263,7 +1507,7 @@
511 511 d1 = damagesource.getSourcePosition().z() - this.getZ();
512 512 }
513 513
514 514 - this.knockback(0.4000000059604645D, d0, d1);
515 515 + this.knockback(0.4000000059604645D, d0, d1, entity1, entity1 == null ? EntityKnockbackEvent.KnockbackCause.DAMAGE : EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
516 516 if (!flag) {
517 517 this.indicateDamage(d0, d1);
518 518 }
519 -@@ -1282,7 +1526,7 @@
519 +@@ -1282,12 +1526,12 @@
520 520 this.playHurtSound(damagesource);
521 521 }
522 522
523 523 - boolean flag2 = !flag || f > 0.0F;
524 524 + boolean flag2 = !flag; // CraftBukkit - Ensure to return false if damage is blocked
525 525
526 526 if (flag2) {
527 527 this.lastDamageSource = damagesource;
528 + this.lastDamageStamp = this.level().getGameTime();
529 +- Iterator iterator = this.getActiveEffects().iterator();
530 ++ Iterator iterator = new LinkedList<>(this.getActiveEffects()).iterator(); // CraftBukkit - SPIGOT-7999: copy to prevent CME in unrelated events
531 +
532 + while (iterator.hasNext()) {
533 + MobEffect mobeffect = (MobEffect) iterator.next();
528 534 @@ -1363,7 +1607,7 @@
529 535 }
530 536
531 537 protected void blockedByShield(EntityLiving entityliving) {
532 538 - entityliving.knockback(0.5D, entityliving.getX() - this.getX(), entityliving.getZ() - this.getZ());
533 539 + entityliving.knockback(0.5D, entityliving.getX() - this.getX(), entityliving.getZ() - this.getZ(), null, EntityKnockbackEvent.KnockbackCause.SHIELD_BLOCK); // CraftBukkit
534 540 }
535 541
536 542 private boolean checkTotemDeathProtection(DamageSource damagesource) {
537 543 @@ -1375,20 +1619,33 @@

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut