Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 02:50:09 +01:00
77a5779e24
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 2ec53f49 PR-1050: Fix empty result check for Complex Recipes 10671012 PR-1044: Add CrafterCraftEvent 4d87ffe0 Use correct method in JavaDoc ae5e5817 SPIGOT-7850: Add API for Bogged shear state 46b6d445 SPIGOT-7837: Support data pack banner patterns d5d0cefc Fix JavaDoc error b3c2b83d PR-1036: Add API for InventoryView derivatives 1fe2c75a SPIGOT-7809: Add ShieldMeta CraftBukkit Changes: 8ee6fd1b8 SPIGOT-7857: Improve ItemMeta block data deserialization 8f26c30c6 SPIGOT-7857: Fix spurious internal NBT tag when deserializing BlockStateMeta 759061b93 SPIGOT-7855: Fire does not spread or burn blocks 00fc9fb64 SPIGOT-7853: AnvilInventory#getRepairCost() always returns 0 7501e2e04 PR-1450: Add CrafterCraftEvent 8c51673e7 SPIGOT-5731: PortalCreateEvent#getEntity returns null for nether portals ignited by flint and steel d53d0d0b1 PR-1456: Fix inverted logic in CraftCrafterView#setSlotDisabled 682a678c8 SPIGOT-7850: Add API for Bogged shear state fccf5243a SPIGOT-7837: Support data pack banner patterns 9c3bd4390 PR-1431: Add API for InventoryView derivatives 0cc6acbc4 SPIGOT-7849: Fix FoodComponent serialize with "using-converts-to" using null 2c5474952 Don't rely on tags for CraftItemMetas 20d107e46 SPIGOT-7846: Fix ItemMeta for hanging signs 76f59e315 Remove redundant clone in Dropper InventoryMoveItemEvent e61a53d25 SPIGOT-7817: Call InventoryMoveItemEvent for Crafters 894682e2d SPIGOT-7839: Remove redundant Java version checks 2c12b2187 SPIGOT-7809: Add ShieldMeta and fix setting shield base colours Spigot Changes: fb8fb722 Rebuild patches 34bd42b7 SPIGOT-7835: Fix issue with custom hopper settings
74 Zeilen
3.8 KiB
Diff
74 Zeilen
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Bjarne Koll <lynxplay101@gmail.com>
|
|
Date: Mon, 8 Jul 2024 22:01:08 +0200
|
|
Subject: [PATCH] Only call EntityDamageEvents before actuallyHurt
|
|
|
|
The recent upstream update moved around the event logic for
|
|
EntiyDamageEvent and its derivatives.
|
|
However, the event was called on every call to #hurt as it was moved out
|
|
of actuallyHurt.
|
|
|
|
This patch moves the invocation directly before the #actuallyHurt calls,
|
|
respective invulnerable timings.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index aff6cd6b717b8fdff373be1db32d26f1305e2be9..d6699caad1909857793e34228cff78dd3b8b6f41 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1459,12 +1459,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
}
|
|
|
|
// CraftBukkit start
|
|
- EntityDamageEvent event = this.handleEntityDamage(source, amount);
|
|
- amount = 0;
|
|
- amount += (float) event.getDamage(DamageModifier.BASE);
|
|
- amount += (float) event.getDamage(DamageModifier.BLOCKING);
|
|
- amount += (float) event.getDamage(DamageModifier.FREEZING);
|
|
- amount += (float) event.getDamage(DamageModifier.HARD_HAT);
|
|
+ EntityDamageEvent event; // Paper - move this into the actual invuln check....
|
|
// CraftBukkit end
|
|
|
|
this.walkAnimation.setSpeed(1.5F);
|
|
@@ -1475,6 +1470,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
return false;
|
|
}
|
|
|
|
+ // Paper start - only call damage event when actuallyHurt will be called - move call logic down
|
|
+ event = this.handleEntityDamage(source, amount);
|
|
+ amount = computeAmountFromEntityDamageEvent(event);
|
|
+ // Paper end - only call damage event when actuallyHurt will be called - move call logic down
|
|
+
|
|
// CraftBukkit start
|
|
if (!this.actuallyHurt(source, (float) event.getFinalDamage() - this.lastHurt, event)) {
|
|
return false;
|
|
@@ -1484,6 +1484,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
this.lastHurt = amount;
|
|
flag1 = false;
|
|
} else {
|
|
+ // Paper start - only call damage event when actuallyHurt will be called - move call logic down
|
|
+ event = this.handleEntityDamage(source, amount);
|
|
+ amount = computeAmountFromEntityDamageEvent(event);
|
|
+ // Paper end - only call damage event when actuallyHurt will be called - move call logic down
|
|
// CraftBukkit start
|
|
if (!this.actuallyHurt(source, (float) event.getFinalDamage(), event)) {
|
|
return false;
|
|
@@ -1615,6 +1619,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
}
|
|
}
|
|
|
|
+ // Paper start - only call damage event when actuallyHurt will be called - move out amount computation logic
|
|
+ private float computeAmountFromEntityDamageEvent(final EntityDamageEvent event) {
|
|
+ // Taken from hurt()'s craftbukkit diff.
|
|
+ float amount = 0;
|
|
+ amount += (float) event.getDamage(DamageModifier.BASE);
|
|
+ amount += (float) event.getDamage(DamageModifier.BLOCKING);
|
|
+ amount += (float) event.getDamage(DamageModifier.FREEZING);
|
|
+ amount += (float) event.getDamage(DamageModifier.HARD_HAT);
|
|
+ return amount;
|
|
+ }
|
|
+ // Paper end - only call damage event when actuallyHurt will be called - move out amount computation logic
|
|
+
|
|
protected void blockUsingShield(LivingEntity attacker) {
|
|
attacker.blockedByShield(this);
|
|
}
|