Skip to content

PickupFromContainerTask picks up lower-tier tools when better ones already in inventory #16

Description

@RiaDev1

Description

When looting containers (chests, etc.), LootContainerTask and PickupFromContainerTask take ALL matching items regardless of tier. If the bot already has an iron pickaxe in inventory, it will still loot wooden/stone pickaxes from the chest — wasting time and inventory slots.

Root Cause

In LootContainerTask.getAMatchingSlot():

for (Item item : targets) {
    List<Slot> slots = mod.getItemStorage().getSlotsWithItemContainer(item);
    if (!slots.isEmpty()) for (Slot slot : slots) {
        if (check.test(StorageHelper.getItemStackInSlot(slot))) return Optional.of(slot);
    }
}

The method returns the FIRST matching slot found, without checking if the bot already has an equal-or-better version of that item type.

Expected Behavior

When the bot already has a diamond pickaxe, it should skip wooden/stone pickaxes in containers unless specifically configured to collect them.

Suggested Fix

Add a tier-aware check: for tool/armor items in the priority arrays (PickaxesTopPriority, etc.), compare the tier of the item in the chest against the best tier already in inventory. Skip items of lower tier than what's already owned.

Related

  • ItemHelper.PickaxesTopPriority (ordered netherite→wooden)
  • LootContainerTask.java
  • PickupFromContainerTask.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions