Interface ReplaceableResultSupplier

  • All Implemented Interfaces:
    io.github.sakaki_aruka.customcrafter.result.ResultSupplier

    
    public interface ReplaceableResultSupplier
     implements ResultSupplier
                        

    A subinterface of ResultSupplier that writes items back into the crafting UI slots after a craft completes, instead of (or in addition to) giving them to the player.

    Typical use cases include ingredient transformation (e.g. returning a modified tool to the grid) and byproduct placement (e.g. returning an empty bucket after consuming a filled one).

    • supply is called on an executor thread (async).

    • replaceQueries is invoked on the calling thread, before the async dispatch, to build the slot-to-item mapping.

    • All UI access (getItem / setItem) is dispatched to the entity's regional scheduler via a single runAtEntity call, ensuring thread safety for both Paper and Folia.

    • After all slots are processed (or the timeout elapses), replaceResultHandler is called with the result of each slot operation.

    • supply itself always returns an empty list; item delivery to the player's inventory is the responsibility of replaceResultHandler if needed.

    If the entity scheduler does not execute within timeoutMilli milliseconds, all slots that have not been processed yet are marked ReplaceState.TIMEOUT and replaceResultHandler is still called.

    Since:

    5.0.21