3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 19:40:07 +01:00

Use empty itemstack, not null in PlayerInteractManager

Introduced in 00a41bca42
Fixes GH-1642
Dieser Commit ist enthalten in:
Zach Brown 2018-11-03 04:50:42 -04:00
Ursprung 00a41bca42
Commit b4baf9ce4d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: CC9DA35FC5450B76

Datei anzeigen

@ -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()) {