Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 11:30:06 +01:00
a98d389d1f
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 CraftBukkit Changes: c3e684ef SPIGOT-3789: Can't Remove Entity Equipment in Same Tick Spawned without using Consumer Spigot Changes: 89d6047d Rebuild patches
46 Zeilen
2.3 KiB
Diff
46 Zeilen
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: kickash32 <kickash32@gmail.com>
|
|
Date: Mon, 19 Aug 2019 19:42:35 +0500
|
|
Subject: [PATCH] Prevent consuming the wrong itemstack
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index b0a2ce464261b6bdb96f78e429a28e48a42e841b..2ad4415b41930b4e002c5c526f0cdd9a1645a38a 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -3100,10 +3100,13 @@ public abstract class EntityLiving extends Entity {
|
|
this.datawatcher.set(EntityLiving.ag, (byte) j);
|
|
}
|
|
|
|
- public void c(EnumHand enumhand) {
|
|
+ // Paper start -- OBFHELPER and forwarder to method with forceUpdate parameter
|
|
+ public void c(EnumHand enumhand) { this.updateActiveItem(enumhand, false); }
|
|
+ public void updateActiveItem(EnumHand enumhand, boolean forceUpdate) {
|
|
+ // Paper end
|
|
ItemStack itemstack = this.b(enumhand);
|
|
|
|
- if (!itemstack.isEmpty() && !this.isHandRaised()) {
|
|
+ if (!itemstack.isEmpty() && !this.isHandRaised() || forceUpdate) { // Paper use override flag
|
|
this.activeItem = itemstack;
|
|
this.bd = itemstack.k();
|
|
if (!this.world.isClientSide) {
|
|
@@ -3181,6 +3184,7 @@ public abstract class EntityLiving extends Entity {
|
|
this.releaseActiveItem();
|
|
} else {
|
|
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
|
|
+ this.updateActiveItem(this.getRaisedHand(), true); // Paper
|
|
this.b(this.activeItem, 16);
|
|
// CraftBukkit start - fire PlayerItemConsumeEvent
|
|
ItemStack itemstack;
|
|
@@ -3215,8 +3219,8 @@ public abstract class EntityLiving extends Entity {
|
|
}
|
|
|
|
this.clearActiveItem();
|
|
- // Paper start - if the replacement is anything but the default, update the client inventory
|
|
- if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) {
|
|
+ // Paper start
|
|
+ if (this instanceof EntityPlayer) {
|
|
((EntityPlayer) this).getBukkitEntity().updateInventory();
|
|
}
|
|
// Paper end
|