Use empty itemstack, not null in PlayerInteractManager

Introduced in 00a41bca42
Fixes GH-1642
This commit is contained in:
Zach Brown 2018-11-03 04:50:42 -04:00
parent 00a41bca42
commit b4baf9ce4d
No known key found for this signature in database
GPG key ID: CC9DA35FC5450B76

View file

@ -1,4 +1,4 @@
From a101ae9254d474be1b9817bb5970ca62414fcdcc Mon Sep 17 00:00:00 2001
From 4b3504dfbcfdcfe361c11919ea7c6597f05b2d5d Mon Sep 17 00:00:00 2001
From: MisterVector <whizkid3000@hotmail.com>
Date: Thu, 1 Nov 2018 14:50:05 -0700
Subject: [PATCH] MC-136865: Use valid item for enchantment checks on block
@ -13,14 +13,14 @@ keep the clone of the item used to a non empty value so it represents
the item used.
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index 23fc4d8e14..599bdf054f 100644
index 23fc4d8e1..0b6c25936 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -375,10 +375,11 @@ public class PlayerInteractManager {
ItemStack itemstack1 = this.player.getItemInMainHand();
boolean flag1 = this.player.hasBlock(iblockdata);
+ ItemStack itemstack2 = flag && flag1 && event.isDropItems() && !itemstack1.isEmpty() ? itemstack1.cloneItemStack() : null; // Paper - MC-136865 - clone before use
+ ItemStack itemstack2 = flag && flag1 && event.isDropItems() && !itemstack1.isEmpty() ? itemstack1.cloneItemStack() : ItemStack.a; // Paper - MC-136865 - clone before use
itemstack1.a(this.world, iblockdata, blockposition, this.player);
// CraftBukkit start - Check if block should drop items
if (flag && flag1 && event.isDropItems()) {