Fix EntityDeathEvent cancellation (#9323)

This commit is contained in:
Lulu13022002 2023-06-12 19:03:51 +02:00 committed by GitHub
parent f4dfdcbb5b
commit eb0693fff7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 65 additions and 62 deletions

View file

@ -70,7 +70,7 @@ index 0578d72681a0d45b6c8d1d6d04208eb14fb60083..2b4c0042b1971a9d922c8d32aa74c7f2
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f3af1c540b59819375f70ffbda6135601802cdbc..5b093a5c4ac0218dbadd6d7045266a164fcf834c 100644
index f3af1c540b59819375f70ffbda6135601802cdbc..b712f505fd092e0366ffc74ff59345a7f8c701be 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -261,6 +261,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -108,7 +108,7 @@ index f3af1c540b59819375f70ffbda6135601802cdbc..5b093a5c4ac0218dbadd6d7045266a16
if (this.deathScore >= 0 && entityliving != null) {
entityliving.awardKillScore(this, this.deathScore, damageSource);
}
@@ -1674,24 +1674,56 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1674,24 +1674,59 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.level().isClientSide && this.hasCustomName()) {
if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
}
@ -137,12 +137,12 @@ index f3af1c540b59819375f70ffbda6135601802cdbc..5b093a5c4ac0218dbadd6d7045266a16
+ this.clearedEquipmentSlots.clear();
+ }
+ // Paper end
+
- if (entity == null || entity.killedEntity(worldserver, this)) {
+ if (this.isSleeping()) {
+ this.stopSleeping();
+ }
- if (entity == null || entity.killedEntity(worldserver, this)) {
+
+ if (!this.level().isClientSide && this.hasCustomName()) {
+ if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
+ }
@ -154,6 +154,9 @@ index f3af1c540b59819375f70ffbda6135601802cdbc..5b093a5c4ac0218dbadd6d7045266a16
this.gameEvent(GameEvent.ENTITY_DIE);
- this.dropAllDeathLoot(damageSource);
- this.createWitherRose(entityliving);
+ } else {
+ this.dead = false;
+ this.setHealth((float) deathEvent.getReviveHealth());
}
- this.level().broadcastEntityEvent(this, (byte) 3);
@ -170,7 +173,7 @@ index f3af1c540b59819375f70ffbda6135601802cdbc..5b093a5c4ac0218dbadd6d7045266a16
}
}
@@ -1699,7 +1731,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1699,7 +1734,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.level().isClientSide) {
boolean flag = false;
@ -179,7 +182,7 @@ index f3af1c540b59819375f70ffbda6135601802cdbc..5b093a5c4ac0218dbadd6d7045266a16
if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
BlockPos blockposition = this.blockPosition();
BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
@@ -1728,7 +1760,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1728,7 +1763,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
@ -192,7 +195,7 @@ index f3af1c540b59819375f70ffbda6135601802cdbc..5b093a5c4ac0218dbadd6d7045266a16
Entity entity = source.getEntity();
int i;
@@ -1743,18 +1779,27 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1743,18 +1782,27 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.dropEquipment(); // CraftBukkit - from below
if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
this.dropFromLootTable(source, flag);

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 5b093a5c4ac0218dbadd6d7045266a164fcf834c..919f5229ac494961a8cb25b375f27753555ed52c 100644
index b712f505fd092e0366ffc74ff59345a7f8c701be..6718b4159b1c670e0a15020ee5dba67566d2adc1 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -117,6 +117,7 @@ import net.minecraft.world.level.storage.loot.LootTable;
@ -16,7 +16,7 @@ index 5b093a5c4ac0218dbadd6d7045266a164fcf834c..919f5229ac494961a8cb25b375f27753
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.PlayerTeam;
@@ -3840,6 +3841,38 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3843,6 +3844,38 @@ public abstract class LivingEntity extends Entity implements Attackable {
return this.level().clip(raytrace);
}

View file

@ -72,10 +72,10 @@ index caeaa3907c1455726a0eeda7e473aacd9f8c3937..9db5795009389c3ca9ba70486dcd7225
if (this.valid) {
Bukkit.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 919f5229ac494961a8cb25b375f27753555ed52c..088a0944793032eb1dc499e0c9255f3738aefc98 100644
index 6718b4159b1c670e0a15020ee5dba67566d2adc1..232e50c36e4c6dc719cc0e07cbe8ec0fd54fee6d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3445,9 +3445,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3448,9 +3448,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
public void stopRiding() {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent consuming the wrong itemstack
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 088a0944793032eb1dc499e0c9255f3738aefc98..a897ed99e7a643244fbe6f0ba1afc1bc15bb8d8d 100644
index 232e50c36e4c6dc719cc0e07cbe8ec0fd54fee6d..901ac163042322de70d008634cb2a99227bbf6e3 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3658,9 +3658,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3661,9 +3661,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void startUsingItem(InteractionHand hand) {
@ -24,7 +24,7 @@ index 088a0944793032eb1dc499e0c9255f3738aefc98..a897ed99e7a643244fbe6f0ba1afc1bc
this.useItem = itemstack;
this.useItemRemaining = itemstack.getUseDuration();
if (!this.level().isClientSide) {
@@ -3740,6 +3745,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3743,6 +3748,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.releaseUsingItem();
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
@ -32,7 +32,7 @@ index 088a0944793032eb1dc499e0c9255f3738aefc98..a897ed99e7a643244fbe6f0ba1afc1bc
this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack;
@@ -3774,8 +3780,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3777,8 +3783,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.stopUsingItem();

View file

@ -7,10 +7,10 @@ When the server is lagging, players will wait longer when eating.
Change to also use a time check instead if it passes.
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index a897ed99e7a643244fbe6f0ba1afc1bc15bb8d8d..a1c8558db314ea34ad483f7f6f70c1833b57b669 100644
index 901ac163042322de70d008634cb2a99227bbf6e3..d322efe93e056f6272221b00b737fd9b6d290404 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3601,6 +3601,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3604,6 +3604,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
}
@ -22,7 +22,7 @@ index a897ed99e7a643244fbe6f0ba1afc1bc15bb8d8d..a1c8558db314ea34ad483f7f6f70c183
private void updatingUsingItem() {
if (this.isUsingItem()) {
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
@@ -3619,7 +3624,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3622,7 +3627,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.triggerItemUseEffects(stack, 5);
}
@ -36,7 +36,7 @@ index a897ed99e7a643244fbe6f0ba1afc1bc15bb8d8d..a1c8558db314ea34ad483f7f6f70c183
this.completeUsingItem();
}
@@ -3667,7 +3677,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3670,7 +3680,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag
this.useItem = itemstack;
@ -48,7 +48,7 @@ index a897ed99e7a643244fbe6f0ba1afc1bc15bb8d8d..a1c8558db314ea34ad483f7f6f70c183
if (!this.level().isClientSide) {
this.setLivingEntityFlag(1, true);
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
@@ -3692,7 +3705,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3695,7 +3708,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
} else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
this.useItem = ItemStack.EMPTY;
@ -60,7 +60,7 @@ index a897ed99e7a643244fbe6f0ba1afc1bc15bb8d8d..a1c8558db314ea34ad483f7f6f70c183
}
}
@@ -3825,7 +3841,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3828,7 +3844,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.useItem = ItemStack.EMPTY;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Entity Jump API
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index a1c8558db314ea34ad483f7f6f70c1833b57b669..55d8856e5fdeee4d38e49f5d4a252cf61212e5cb 100644
index d322efe93e056f6272221b00b737fd9b6d290404..ba1e09e310e48d10be86d2679f6853c0cdc603c4 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3262,8 +3262,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3265,8 +3265,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
} else if (this.isInLava() && (!this.onGround() || d7 > d8)) {
this.jumpInLiquid(FluidTags.LAVA);
} else if ((this.onGround() || flag && d7 <= d8) && this.noJumpDelay == 0) {

View file

@ -12,10 +12,10 @@ The entity's current team collision rule causes them to NEVER collide.
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 55d8856e5fdeee4d38e49f5d4a252cf61212e5cb..6bd0dcba534926716e26da6c171737ff1bc91ea7 100644
index ba1e09e310e48d10be86d2679f6853c0cdc603c4..5132df70d5ef092030db43275b6526b8ac465d1f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3377,10 +3377,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3380,10 +3380,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.level().isClientSide()) {
this.level().getEntities(EntityTypeTest.forClass(net.minecraft.world.entity.player.Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush);
} else {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 6bd0dcba534926716e26da6c171737ff1bc91ea7..909ff425123228437cf3ab39c6733cd0a6dd2ef1 100644
index 5132df70d5ef092030db43275b6526b8ac465d1f..02f5992f859163ea3fa77b3607bc9a0a29c17723 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2169,7 +2169,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2172,7 +2172,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) {

View file

@ -80,7 +80,7 @@ index 997f73e86d62b546e363382a3126bc43b4b17b7f..909d0c96840724033bd907560db46d4c
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 909ff425123228437cf3ab39c6733cd0a6dd2ef1..258d055a368629154ab149813881e130fc51f698 100644
index 02f5992f859163ea3fa77b3607bc9a0a29c17723..f8c2ff77f8db6f3e31eb2ef4d8638a736fcc0295 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1688,9 +1688,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -96,7 +96,7 @@ index 909ff425123228437cf3ab39c6733cd0a6dd2ef1..258d055a368629154ab149813881e130
// Paper start - clear equipment if event is not cancelled
if (this instanceof Mob) {
for (EquipmentSlot slot : this.clearedEquipmentSlots) {
@@ -1788,8 +1788,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1791,8 +1791,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.dropCustomDeathLoot(source, i, flag);
this.clearEquipmentSlots = prev; // Paper
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 258d055a368629154ab149813881e130fc51f698..a062c5117af949682ee9be87c860484f64a60f3e 100644
index f8c2ff77f8db6f3e31eb2ef4d8638a736fcc0295..4ebe18685bdbdb11e29537342c2a74ce5202db6d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3484,7 +3484,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3487,7 +3487,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
Entity entity = this.getVehicle();
super.stopRiding(suppressCancellation); // Paper - suppress

View file

@ -45,10 +45,10 @@ index d15e62da0307728a7c2be191a27f87da1bb29f49..de06ae3e8757c923a6f3f475a34885d2
} else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
return false;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index a062c5117af949682ee9be87c860484f64a60f3e..9413fc2010804c9524ad754249916432b3ff4543 100644
index 4ebe18685bdbdb11e29537342c2a74ce5202db6d..77fe0eaadaf7c79b441d1f5ca3bc0da01261ebba 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3405,7 +3405,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3408,7 +3408,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
return;
}
// Paper end - don't run getEntities if we're not going to use its result
@ -57,7 +57,7 @@ index a062c5117af949682ee9be87c860484f64a60f3e..9413fc2010804c9524ad754249916432
if (!list.isEmpty()) {
// Paper - moved up
@@ -3565,9 +3565,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3568,9 +3568,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
return !this.isRemoved() && this.collides; // CraftBukkit
}

View file

@ -29,10 +29,10 @@ index fb256e7c60f4e82b028f6768f591098882e27dd1..cfd0e75ac4e7edbd219cc0f5fb802e37
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 9413fc2010804c9524ad754249916432b3ff4543..6f0dc5e3a9bd2c3e7c65fe6f93966cd579536a9c 100644
index 77fe0eaadaf7c79b441d1f5ca3bc0da01261ebba..1efe051326b83354c4e72c1d25054f27f1f84cf1 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3340,6 +3340,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3343,6 +3343,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.pushEntities();
this.level().getProfiler().pop();

View file

@ -9,10 +9,10 @@ till their item is switched.
This patch clears the active item when the event is cancelled
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 6f0dc5e3a9bd2c3e7c65fe6f93966cd579536a9c..955402605dafa29d204b2b0fcb48d59849bcbb1a 100644
index 1efe051326b83354c4e72c1d25054f27f1f84cf1..bce63453fb04db09b10550197f749c959b30a37e 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3824,6 +3824,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3827,6 +3827,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.level().getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Line Of Sight Changes
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 955402605dafa29d204b2b0fcb48d59849bcbb1a..c65aa2ed46ac8cef2306eb4035c7a0742a3e8b08 100644
index bce63453fb04db09b10550197f749c959b30a37e..62e8586d30950eed81868ccbb48212a426774da3 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3555,7 +3555,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3558,7 +3558,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());

View file

@ -17,7 +17,7 @@ index 7354711e194ab58b11b68f447c1fc795fe611a65..5579dad0ba8f2e4ce43883e7d36059c2
};
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f82323c18792882dbbadc78a382dc7ffa9a4612f..090d256dc5594edf1b053cc072b177cbf92143bb 100644
index 9cc26c870d3785c7ab798cf53f10ad8fd942bfb0..0378b20decc9f22a480f68e8062c3b60d01d966e 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1383,7 +1383,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -44,7 +44,7 @@ index f82323c18792882dbbadc78a382dc7ffa9a4612f..090d256dc5594edf1b053cc072b177cb
d0 = (Math.random() - Math.random()) * 0.01D;
}
@@ -2220,7 +2221,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2223,7 +2224,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING));
Entity entity = damagesource.getDirectEntity();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 27da81c4577ea3c4efaf4e719c2b8256d4707920..6a6ec6419dbbdd6dabb6dd5697f3139924b1fd78 100644
index dd95550877d67d8521a96f1e31994cff894502e1..70cdcc7508998ef1b107f60c619c3d521dadd124 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2655,13 +2655,26 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2658,13 +2658,26 @@ public abstract class LivingEntity extends Entity implements Attackable {
return this.hasEffect(MobEffects.JUMP) ? 0.1F * ((float) this.getEffect(MobEffects.JUMP).getAmplifier() + 1.0F) : 0.0F;
}

View file

@ -34,10 +34,10 @@ index 09f6948a52721b27ccd7c761a7efd09bfd7a183c..71a8812365503d840f6702a21d504a37
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 6a6ec6419dbbdd6dabb6dd5697f3139924b1fd78..fa26a234c999d4353a0287988a47440508d3783f 100644
index 70cdcc7508998ef1b107f60c619c3d521dadd124..3161b5da8bd4045123ee067ffc693165507a02ea 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3164,7 +3164,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3167,7 +3167,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
equipmentChanges.forEach((enumitemslot, itemstack) -> {
ItemStack itemstack1 = itemstack.copy();
@ -49,7 +49,7 @@ index 6a6ec6419dbbdd6dabb6dd5697f3139924b1fd78..fa26a234c999d4353a0287988a474405
switch (enumitemslot.getType()) {
case HAND:
this.setLastHandItem(enumitemslot, itemstack1);
@@ -3177,6 +3180,34 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3180,6 +3183,34 @@ public abstract class LivingEntity extends Entity implements Attackable {
((ServerLevel) this.level()).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
}

View file

@ -33,10 +33,10 @@ index 674b57f31b15a47054c4b07093ab43294a289171..6297f05bdaaa53cfab2ef019e2d30622
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index fa26a234c999d4353a0287988a47440508d3783f..0ebb1e0ea091a6a0334f8c53f8ed11d5944d3670 100644
index 3161b5da8bd4045123ee067ffc693165507a02ea..5287ff8b30a6d27ca05241695a6c99e868a5aa36 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3166,7 +3166,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3169,7 +3169,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
// Paper start - prevent oversized data
ItemStack toSend = sanitizeItemStack(itemstack1, true);
@ -45,7 +45,7 @@ index fa26a234c999d4353a0287988a47440508d3783f..0ebb1e0ea091a6a0334f8c53f8ed11d5
// Paper end
switch (enumitemslot.getType()) {
case HAND:
@@ -3180,6 +3180,70 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3183,6 +3183,70 @@ public abstract class LivingEntity extends Entity implements Attackable {
((ServerLevel) this.level()).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
}

View file

@ -46,10 +46,10 @@ index ef5e979d09df13660ac7893be1209c2c2b8a136c..dc676cdabfa306a3975e25f981078ead
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 0ebb1e0ea091a6a0334f8c53f8ed11d5944d3670..3150f04897488c9bf60fe8921111377c72c063e5 100644
index 5287ff8b30a6d27ca05241695a6c99e868a5aa36..351c60a6f1dfc00aa1a300ed929e81df8d0d025a 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3424,7 +3424,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3427,7 +3427,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.level().getProfiler().pop();
this.level().getProfiler().push("freezing");

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerStopUsingItemEvent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 3150f04897488c9bf60fe8921111377c72c063e5..b6e45ba7569a07f86516b89962c6d82ec22315f8 100644
index 351c60a6f1dfc00aa1a300ed929e81df8d0d025a..680e1d6f2e3391e377be5c488e0554ccbb852f84 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3983,6 +3983,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3986,6 +3986,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
public void releaseUsingItem() {
if (!this.useItem.isEmpty()) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Stop large look changes from crashing the server
Co-authored-by: Jaren Knodel <Jaren@Knodel.com>
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index b6e45ba7569a07f86516b89962c6d82ec22315f8..e489459a78ed945cfc345f4e3329bdd41e2bfb6f 100644
index 680e1d6f2e3391e377be5c488e0554ccbb852f84..14d9bd4b32f2d7f34283e1efcd780c07ac498d6c 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3034,37 +3034,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3037,37 +3037,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.level().getProfiler().pop();
this.level().getProfiler().push("rangeChecks");

View file

@ -24,10 +24,10 @@ index 5bdae591d344fc9b72ffcc1a44fb5e495b1e6bb2..37873ea2876a89ac8ea702ab0a71171e
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e489459a78ed945cfc345f4e3329bdd41e2bfb6f..d688308e12f44100e6296740f600ec3b064efe88 100644
index 14d9bd4b32f2d7f34283e1efcd780c07ac498d6c..e59738a15c3db0d11bb7007af160aa1845cafd28 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3620,7 +3620,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3623,7 +3623,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void onItemPickup(ItemEntity item) {

View file

@ -23,10 +23,10 @@ index f054d67a637b204de604fadc0d321f5c9816d808..fc5f1e1b445f0a55a35a31d58a90920a
return !this.getResponse();
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 3746bcda0972c5c0f48df894248aa4398983c267..67627bbf84f5aab2872f636b1dcb6728c8494147 100644
index 98a6480b32a1897dfcae84ed72409441519a827f..a189461330a4d427a7450d504ef13de3605497e3 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2280,7 +2280,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2283,7 +2283,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
// Duplicate triggers if blocking
if (event.getDamage(DamageModifier.BLOCKING) < 0) {
if (this instanceof ServerPlayer) {
@ -35,7 +35,7 @@ index 3746bcda0972c5c0f48df894248aa4398983c267..67627bbf84f5aab2872f636b1dcb6728
f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
if (f2 > 0.0F && f2 < 3.4028235E37F) {
((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
@@ -2288,7 +2288,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2291,7 +2291,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
if (damagesource.getEntity() instanceof ServerPlayer) {