InventoryAssert for verifying inventory contents by section and slot, and LootAssert for verifying drop lists after entity kills or loot table rolls.
InventoryAssert
Section Constants
Inventories are divided into sections. HRTK defines constants for the three standard sections:| Constant | Value | Description |
|---|---|---|
SECTION_STORAGE | 0 | Main storage area |
SECTION_ARMOR | 1 | Armor equipment slots |
SECTION_HOTBAR | 2 | Hotbar slots |
Methods
| Method | Description |
|---|---|
assertSlotContains(inventory, section, slot, itemId, quantity) | Slot has expected item and count |
assertSlotEmpty(inventory, section, slot) | Slot is empty |
assertInventoryContains(inventory, itemId) | Any slot in any section has the item |
assertInventoryEmpty(inventory) | All slots in all sections are empty |
assertItemStackEquals(stack, itemId, quantity) | Item stack matches expected values |
Examples
Check a specific slot
Check a specific slot
Verify empty inventory
Verify empty inventory
Search across all sections
Search across all sections
Verify item stack properties
Verify item stack properties
LootAssert
Loot assertions work onList<?> of dropped item stacks — the kind of list you get when an entity dies or a loot table is rolled.
Methods
| Method | Description |
|---|---|
assertDropsContain(drops, itemId) | Drops include at least one stack of the item |
assertDropsContain(drops, itemId, minQuantity) | Drops include the item with at least N total |
assertDropCount(drops, expected) | Drops list has exactly N stacks |
assertDropCountBetween(drops, min, max) | Drop count is within range (inclusive) |
assertNoDrops(drops) | Drops list is empty |
Examples
Verify expected loot drops
Verify expected loot drops
Verify drop quantity
Verify drop quantity
Assert no drops on peaceful entity
Assert no drops on peaceful entity
Assert drop count range for randomized loot
Assert drop count range for randomized loot
Isolation
Inventory and loot tests typically mutate entity state. UseIsolationStrategy.DEDICATED_WORLD:
Next Steps
- Effects — status effect assertions
- Stats & Combat — health and damage checks
- Flow Tests — multi-step spawn-kill-loot flows