aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0413-Prevent-consuming-the-wrong-itemstack.patch
diff options
context:
space:
mode:
authorOmer Uddin <[email protected]>2019-08-19 20:24:33 +0500
committerShane Freeder <[email protected]>2019-08-19 16:24:33 +0100
commit88722ec89cfe0bfcb4312a1b5d812d526e16ac82 (patch)
tree6a4d2c3b4c03ee44a364f4d47c4496d8a1ea7ca0 /Spigot-Server-Patches/0413-Prevent-consuming-the-wrong-itemstack.patch
parent294e30462b65a5031bfb3b7225b66feac039511d (diff)
downloadPaper-88722ec89cfe0bfcb4312a1b5d812d526e16ac82.tar.gz
Paper-88722ec89cfe0bfcb4312a1b5d812d526e16ac82.zip
Prevent consuming the wrong itemstack (#2477)
Diffstat (limited to 'Spigot-Server-Patches/0413-Prevent-consuming-the-wrong-itemstack.patch')
-rw-r--r--Spigot-Server-Patches/0413-Prevent-consuming-the-wrong-itemstack.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0413-Prevent-consuming-the-wrong-itemstack.patch b/Spigot-Server-Patches/0413-Prevent-consuming-the-wrong-itemstack.patch
new file mode 100644
index 0000000000..bf11daa6f4
--- /dev/null
+++ b/Spigot-Server-Patches/0413-Prevent-consuming-the-wrong-itemstack.patch
@@ -0,0 +1,48 @@
+From a4b3835b873a9830e7ef1a652e229e06876214ce Mon Sep 17 00:00:00 2001
+From: kickash32 <[email protected]>
+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 31d14b19b..f675ad2f5 100644
+--- a/src/main/java/net/minecraft/server/EntityLiving.java
++++ b/src/main/java/net/minecraft/server/EntityLiving.java
+@@ -2822,10 +2822,13 @@ public abstract class EntityLiving extends Entity {
+ this.datawatcher.set(EntityLiving.ar, (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.bo = itemstack.k();
+ if (!this.world.isClientSide) {
+@@ -2898,6 +2901,7 @@ public abstract class EntityLiving extends Entity {
+
+ protected void q() {
+ if (!this.activeItem.isEmpty() && this.isHandRaised()) {
++ this.updateActiveItem(this.getRaisedHand(), true); // Paper
+ PlayerItemConsumeEvent event = null; // Paper
+ this.b(this.activeItem, 16);
+ // CraftBukkit start - fire PlayerItemConsumeEvent
+@@ -2928,8 +2932,8 @@ public abstract class EntityLiving extends Entity {
+ this.a(this.getRaisedHand(), itemstack);
+ // CraftBukkit end
+ this.dp();
+- // 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
+--
+2.22.0
+