From d22ab815e3006835ec55ffe75184be9d926b2547 Mon Sep 17 00:00:00 2001 From: Kevin <115616336+lag@users.noreply.github.com> Date: Thu, 5 Mar 2026 21:20:40 -0600 Subject: Initial fixes for ContainerSetSlotPacket and CraftItemPacket (#649) --- Minecraft.World/Inventory.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Minecraft.World/Inventory.cpp') diff --git a/Minecraft.World/Inventory.cpp b/Minecraft.World/Inventory.cpp index 1b9ff630..4a524bab 100644 --- a/Minecraft.World/Inventory.cpp +++ b/Minecraft.World/Inventory.cpp @@ -343,6 +343,18 @@ bool Inventory::hasResource(int type) return true; } +int Inventory::countResource(int type, int auxVal) +{ + int count = 0; + for (unsigned int i = 0; i < items.length; i++) + { + if (items[i] != NULL && items[i]->id == type && + (auxVal == -1 || items[i]->getAuxValue() == auxVal)) + count += items[i]->count; + } + return count; +} + void Inventory::swapSlots(int from, int to) { shared_ptr tmp = items[to]; -- cgit v1.2.3