mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
46 lines
2.5 KiB
Diff
46 lines
2.5 KiB
Diff
From 5c745b48d2a4917947844408f63a581d5f626fb0 Mon Sep 17 00:00:00 2001
|
|
From: md_5 <md_5@bigpond.com>
|
|
Date: Sun, 23 Dec 2012 17:51:07 +1100
|
|
Subject: [PATCH] Update item merge logic
|
|
|
|
---
|
|
src/main/java/net/minecraft/server/World.java | 15 +++++++--------
|
|
1 file changed, 7 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index 9906b9e..1e36467 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -924,6 +924,7 @@ public abstract class World implements IBlockAccess {
|
|
event = CraftEventFactory.callItemSpawnEvent((EntityItem) entity);
|
|
// Spigot start
|
|
ItemStack item = ((EntityItem) entity).getItemStack();
|
|
+ org.bukkit.craftbukkit.inventory.CraftItemStack craft = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item);
|
|
int maxSize = item.getMaxStackSize();
|
|
if (item.count < maxSize) {
|
|
double radius = this.getWorld().itemMergeRadius;
|
|
@@ -933,14 +934,12 @@ public abstract class World implements IBlockAccess {
|
|
if (e instanceof EntityItem) {
|
|
EntityItem loopItem = (EntityItem) e;
|
|
ItemStack loopStack = loopItem.getItemStack();
|
|
- if (!loopItem.dead && loopStack.id == item.id && loopStack.getData() == item.getData()) {
|
|
- if (loopStack.tag == null || item.tag == null || !loopStack.tag.equals(item.tag)) {
|
|
- int toAdd = Math.min(loopStack.count, maxSize - item.count);
|
|
- item.count += toAdd;
|
|
- loopStack.count -= toAdd;
|
|
- if (loopStack.count <= 0) {
|
|
- loopItem.die();
|
|
- }
|
|
+ if (!loopItem.dead && craft.isSimilar(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(loopStack))) {
|
|
+ int toAdd = Math.min(loopStack.count, maxSize - item.count);
|
|
+ item.count += toAdd;
|
|
+ loopStack.count -= toAdd;
|
|
+ if (loopStack.count <= 0) {
|
|
+ loopItem.die();
|
|
}
|
|
}
|
|
}
|
|
--
|
|
1.8.1-rc2
|
|
|