summaryrefslogtreecommitdiffstats
path: root/src/Inventory.cpp
diff options
context:
space:
mode:
authorx12xx12x <44411062+12xx12@users.noreply.github.com>2021-12-02 00:31:10 +0100
committerGitHub <noreply@github.com>2021-12-02 00:31:10 +0100
commit3ff57559e36d3254c64e334fbe3bdd47398fe16f (patch)
tree30a73d405640285863bfa9932afbee482f36b50c /src/Inventory.cpp
parentAdded ExperienceAmount variable to HOOK_PLAYER_FISHING and HOOK_PLAYER_FISHED (#5345) (diff)
downloadcuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar.gz
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar.bz2
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar.lz
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar.xz
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.tar.zst
cuberite-3ff57559e36d3254c64e334fbe3bdd47398fe16f.zip
Diffstat (limited to 'src/Inventory.cpp')
-rw-r--r--src/Inventory.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index 6509dfe5d..2fdd1c25f 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -78,7 +78,7 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int
}
char NumLeft = a_ItemStack.m_ItemCount;
- int MaxStack = ItemHandler(a_ItemStack.m_ItemType)->GetMaxStackSize();
+ int MaxStack = a_ItemStack.GetMaxStackSize();
for (int i = a_BeginSlotNum; i <= a_EndSlotNum; i++)
{
const cItem & Slot = GetSlot(i);
@@ -260,8 +260,7 @@ int cInventory::ReplaceOneEquippedItem(const cItem & a_Item, bool a_TryOtherSlot
cItem ItemsToAdd = a_Item;
if (EquippedItem.IsEqual(ItemsToAdd))
{
- cItemHandler Handler(ItemsToAdd.m_ItemType);
- auto AmountToAdd = std::min(static_cast<char>(Handler.GetMaxStackSize() - EquippedItem.m_ItemCount), ItemsToAdd.m_ItemCount);
+ auto AmountToAdd = std::min(static_cast<char>(ItemsToAdd.GetMaxStackSize() - EquippedItem.m_ItemCount), ItemsToAdd.m_ItemCount);
EquippedItem.m_ItemCount += AmountToAdd;
SetEquippedItem(EquippedItem);
@@ -689,7 +688,7 @@ void cInventory::UpdateItems(void)
const cItem & Slot = GetEquippedItem();
if (!Slot.IsEmpty())
{
- ItemHandler(Slot.m_ItemType)->OnUpdate(m_Owner.GetWorld(), &m_Owner, Slot);
+ Slot.GetHandler().OnUpdate(m_Owner.GetWorld(), &m_Owner, Slot);
}
}