2019-05-27 07:17:12 +02:00
|
|
|
From 659e995f3d68ba6cdb4e8c90755a585c939550fc Mon Sep 17 00:00:00 2001
|
2018-11-01 22:53:43 +01:00
|
|
|
From: MisterVector <whizkid3000@hotmail.com>
|
|
|
|
Date: Thu, 1 Nov 2018 14:50:05 -0700
|
2018-11-02 01:05:18 +01:00
|
|
|
Subject: [PATCH] MC-136865: Use valid item for enchantment checks on block
|
|
|
|
break
|
2018-11-01 22:53:43 +01:00
|
|
|
|
|
|
|
When an itemstack runs out of durability, the amount is reduced to
|
|
|
|
0 which then marks the item as invalid. This causes the last unit
|
|
|
|
of durability to not apply enchantments as the enchantment level
|
|
|
|
check sees the item as a dud.
|
|
|
|
|
|
|
|
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
|
2019-05-14 23:54:32 +02:00
|
|
|
index f692da609b..5bc8bd7cdc 100644
|
2018-11-01 22:53:43 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
2019-05-05 13:12:32 +02:00
|
|
|
@@ -354,10 +354,11 @@ public class PlayerInteractManager {
|
2018-11-03 05:18:10 +01:00
|
|
|
ItemStack itemstack1 = this.player.getItemInMainHand();
|
|
|
|
boolean flag1 = this.player.hasBlock(iblockdata);
|
|
|
|
|
2018-11-03 09:50:42 +01:00
|
|
|
+ ItemStack itemstack2 = flag && flag1 && event.isDropItems() && !itemstack1.isEmpty() ? itemstack1.cloneItemStack() : ItemStack.a; // Paper - MC-136865 - clone before use
|
2018-11-01 22:53:43 +01:00
|
|
|
itemstack1.a(this.world, iblockdata, blockposition, this.player);
|
|
|
|
// CraftBukkit start - Check if block should drop items
|
|
|
|
if (flag && flag1 && event.isDropItems()) {
|
|
|
|
- ItemStack itemstack2 = itemstack1.isEmpty() ? ItemStack.a : itemstack1.cloneItemStack();
|
2018-11-03 05:18:10 +01:00
|
|
|
+ //ItemStack itemstack2 = itemstack1.isEmpty() ? ItemStack.a : itemstack1.cloneItemStack(); // Paper - MC-136865 - move up
|
2018-11-01 22:53:43 +01:00
|
|
|
|
|
|
|
iblockdata.getBlock().a(this.world, this.player, blockposition, iblockdata, tileentity, itemstack2);
|
|
|
|
}
|
|
|
|
--
|
2019-05-05 13:32:20 +02:00
|
|
|
2.21.0
|
2018-11-01 22:53:43 +01:00
|
|
|
|