Skip to content

Prevent the cookery from keeping all empty bottles #10367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: version/main
Choose a base branch
from

Conversation

Thodor12
Copy link
Contributor

Closes #10360

Changes proposed in this pull request

  • The cookery was holding onto bottles because secondary outputs in crafters are never tracked, so they will remain in the inventory of the crafter forever
  • Extended pickup requests to supply an optional filter which the courier can utilize to see what items are allowed to be picked up.
    This way crafters can tell couriers to pick up all secondary outputs of the crafter.

Testing

  • Yes I tested this before submitting it.
  • I also did a multiplayer test.

Review please

marchermans
marchermans previously approved these changes Nov 19, 2024
# Conflicts:
#	src/main/java/com/minecolonies/core/entity/ai/workers/service/EntityAIWorkDeliveryman.java
* The itemstack to filter for this specific pickup.
*/
@Nullable
private List<ItemStack> pickupFilter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just initiate this with an empty list to simplify the rest of the logic.

{
super(priority);
if (filter != null)
{
this.pickupFilter = filter.stream().map(ItemStack::copy).collect(Collectors.toList());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can just use empty list instead and then avoid the nullable. Why do we need a deep copy?

@@ -464,6 +464,11 @@ protected IAIState craft()
module.improveRecipe(currentRecipeStorage, job.getCraftCounter(), worker.getCitizenData());
}

if (!currentRecipeStorage.getSecondaryOutputs().isEmpty())
{
building.createPickupRequest(10, currentRecipeStorage.getSecondaryOutputs());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indicates that it's not a pickup filter, but instead it's sort of a specific pickup request".

final ItemStack activeStack = handler.extractItem(currentSlot, filter.getCount(), false);
transferItemForPickup(activeStack);
if (filter.getCount() == activeStack.getCount())
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels weird to be iterator based. Can't we just make this a if pickupList.contains(new ItemStorage(stackInCurrentSlot)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cookery not requesting pickups for multiple stacks of empty bottles
3 participants