Fix entity equipment on cancellation of EntityDeathEvent (#5740)

This commit is contained in:
Jake Potrebic 2021-12-08 10:25:57 -08:00 committed by GitHub
parent 33ea869a65
commit 74fd151adc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 151 additions and 73 deletions

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 8bdaf925580480a9467b5611e77580bb205c0a4a..bb53c547e31ed9d7bcc04b06d774b70607ef927f 100644
index 75beea5653d04555b46c4b3a2054405c6aefc421..2b2258b8cc35385b857114d0e8a958cd24fa7d26 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3558,9 +3558,14 @@ public abstract class LivingEntity extends Entity {
@@ -3567,9 +3567,14 @@ public abstract class LivingEntity extends Entity {
}
public void startUsingItem(InteractionHand hand) {
@ -24,7 +24,7 @@ index 8bdaf925580480a9467b5611e77580bb205c0a4a..bb53c547e31ed9d7bcc04b06d774b706
this.useItem = itemstack;
this.useItemRemaining = itemstack.getUseDuration();
if (!this.level.isClientSide) {
@@ -3639,6 +3644,7 @@ public abstract class LivingEntity extends Entity {
@@ -3648,6 +3653,7 @@ public abstract class LivingEntity extends Entity {
this.releaseUsingItem();
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
@ -32,7 +32,7 @@ index 8bdaf925580480a9467b5611e77580bb205c0a4a..bb53c547e31ed9d7bcc04b06d774b706
this.triggerItemUseEffects(this.useItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack;
@@ -3673,8 +3679,8 @@ public abstract class LivingEntity extends Entity {
@@ -3682,8 +3688,8 @@ public abstract class LivingEntity extends Entity {
}
this.stopUsingItem();