MineColonies

MineColonies

57M Downloads

Dman should leave X in the workers chest.

Raycoms opened this issue ยท 4 comments

commented
    /**
     * Check if the worker requires a certain amount of that item and if the deliveryman already kept it.
     * Always leave one stack behind if the worker requires a certain amount of it. Just to be sure.
     *
     * @param building         the building of the worker.
     * @param stack            the stack to check it with.
     * @param localAlreadyKept already kept items.
     * @return true if deliveryman should leave it behind.
     */
    private static boolean buildingRequiresCertainAmountOfItem(AbstractBuilding building, ItemStack stack, List<ItemStorage> localAlreadyKept)
    {
        for (final Map.Entry<ItemStorage, Integer> entry : building.getRequiredItemsAndAmount().entrySet())
        {
            if (entry.getKey().getItem() == stack.getItem()
                    && entry.getKey().getDamageValue() == stack.getItemDamage()
                    && !localAlreadyKept.contains(entry.getKey()))
            {
                localAlreadyKept.add(entry.getKey());
                return true;
            }
        }
        return false;
    }

I don't see how this method correctly counts the item.
Do we do that somewhere else
@xavierh ?

commented

Yeah.. thought I'd nudge it in here to see if while fixing one thing it might be able to fix the other.
Thanks.

commented

This issue is related to the same issue I opened 6 months ago?
Or could this fix implement the fix I suggest in issue #642 ?
https://github.com/Minecolonies/minecolonies/issues/642

commented

Currently, we have static lists inside the workers code which should tell the dman that a certain amount of the items should stay in the workers chest.
While, as I understood, #642 proposes a player maintained list.
The problem here is that the list we have is not followed by the dman. The dman just leaves 1 stack of the item not caring about how many items are in that stack.

commented

Sorry @Raycoms busy with more important things lately :-/
Could you point me to the file where this code is in ?