Search in sources :

Example 1 with AccessorCraftingScreenHandler

use of top.theillusivec4.polymorph.mixin.core.AccessorCraftingScreenHandler in project Polymorph by TheIllusiveC4.

the class FastBenchModule method selectRecipe.

@Override
public boolean selectRecipe(ScreenHandler screenHandler, Recipe<?> recipe) {
    if (recipe instanceof CraftingRecipe) {
        CraftingResultInventory result = null;
        if (screenHandler instanceof CraftingScreenHandler) {
            AccessorCraftingScreenHandler accessor = (AccessorCraftingScreenHandler) screenHandler;
            result = accessor.getResult();
        } else if (screenHandler instanceof PlayerScreenHandler) {
            AccessorPlayerScreenHandler accessor = (AccessorPlayerScreenHandler) screenHandler;
            result = accessor.getCraftingResult();
        }
        if (result != null) {
            result.setLastRecipe(recipe);
        }
    }
    return false;
}
Also used : CraftingScreenHandler(net.minecraft.screen.CraftingScreenHandler) AccessorCraftingScreenHandler(top.theillusivec4.polymorph.mixin.core.AccessorCraftingScreenHandler) AccessorCraftingScreenHandler(top.theillusivec4.polymorph.mixin.core.AccessorCraftingScreenHandler) CraftingResultInventory(net.minecraft.inventory.CraftingResultInventory) CraftingRecipe(net.minecraft.recipe.CraftingRecipe) AccessorPlayerScreenHandler(top.theillusivec4.polymorph.mixin.core.AccessorPlayerScreenHandler) PlayerScreenHandler(net.minecraft.screen.PlayerScreenHandler) AccessorPlayerScreenHandler(top.theillusivec4.polymorph.mixin.core.AccessorPlayerScreenHandler)

Aggregations

CraftingResultInventory (net.minecraft.inventory.CraftingResultInventory)1 CraftingRecipe (net.minecraft.recipe.CraftingRecipe)1 CraftingScreenHandler (net.minecraft.screen.CraftingScreenHandler)1 PlayerScreenHandler (net.minecraft.screen.PlayerScreenHandler)1 AccessorCraftingScreenHandler (top.theillusivec4.polymorph.mixin.core.AccessorCraftingScreenHandler)1 AccessorPlayerScreenHandler (top.theillusivec4.polymorph.mixin.core.AccessorPlayerScreenHandler)1