Skip to content

Conversation

@AlexiyOrlov
Copy link

This PR makes it possible to properly implement item transfer handler for recipes that have inputs with variable item stack size inputs.
For this I added a default method to IRecipeTransferHandler, where a user can return item stack sizes for transferred items.
This method is then passed to BasicRecipeTransferHandlerServer through PacketRecipeTransfer. If the list is empty, transfer behaves as before, otherwise stack sizes are given to net.minecraft.world.inventory.Slot#safeTake, which handles item extraction.
Also I had to replace 3 hash maps with linked hash maps to preserve stack size to slot mapping.
I exposed IRecipeTransferHandlerHelper in the transfer handler registration method to allow getting IStackHelper for use in transfer handler instantiation.
I tested these changes in my mod I'm developing. I have custom recipe type that can have input items with variable size, so I decided to make this PR.

…m amount transfer method; expose stack helper; implement item transfer with variable size input stack
@CLAassistant
Copy link

CLAassistant commented Dec 20, 2024

CLA assistant check
All committers have signed the CLA.

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.

2 participants