inventory_mock tests #17

Merged
erns6604 merged 16 commits from inventory_mocks into main 2025-10-30 07:52:55 +01:00
2 changed files with 3 additions and 4 deletions
Showing only changes of commit 7dc1fb7edd - Show all commits

View File

@@ -1,6 +1,5 @@
package Inventory; package Inventory;
import Item.Item;
import Item.ItemStack; import Item.ItemStack;
import java.util.ArrayList; import java.util.ArrayList;
@@ -27,11 +26,10 @@ public class Inventory {
public void addItem(ItemStack stack) { public void addItem(ItemStack stack) {
if (stack.getWeight() + getCurrentWeight() > maxWeight) { if (stack.getWeight() + getCurrentWeight() > maxWeight) {
if(stack.isSingleItem()) return;
trySubstack(stack); trySubstack(stack);
return; } else {
items.add(stack);
} }
items.add(stack);
} }
private void trySubstack(ItemStack stack) { private void trySubstack(ItemStack stack) {

View File

@@ -41,6 +41,7 @@ public class LootTable<T> {
return entry.item(); return entry.item();
} }
} }
// Unreachable code. entries always have an entry or the class cant be instantiated.
return null; return null;
} }