From ae7fb9b5bea291f81a82912d42fc43b7e71702bf Mon Sep 17 00:00:00 2001 From: Xunto Date: Fri, 22 Apr 2016 15:49:06 +0300 Subject: [PATCH] Inventory: Make ItemStack with different metadata not stackable --- src/inventory.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/inventory.cpp b/src/inventory.cpp index fce8575e7..cb8faecbc 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -335,8 +335,9 @@ ItemStack ItemStack::addItem(const ItemStack &newitem_, *this = newitem; newitem.clear(); } - // If item name differs, bail out - else if(name != newitem.name) + // If item name or metadata differs, bail out + else if (name != newitem.name + || metadata != newitem.metadata) { // cannot be added } @@ -374,8 +375,9 @@ bool ItemStack::itemFits(const ItemStack &newitem_, { newitem.clear(); } - // If item name differs, bail out - else if(name != newitem.name) + // If item name or metadata differs, bail out + else if (name != newitem.name + || metadata != newitem.metadata) { // cannot be added }