Search in sources :

Example 1 with PlayerScreenHandler

use of net.minecraft.screen.PlayerScreenHandler 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)

Example 2 with PlayerScreenHandler

use of net.minecraft.screen.PlayerScreenHandler in project Hypnotic-Client by Hypnotic-Development.

the class InventoryScreenMixin method dupe.

// Credits to Duper Trooper for publishing the dupe
// Original video https://www.youtube.com/watch?v=8Xd7DcApFbM
private void dupe() {
    Slot outputSlot = (Slot) ((PlayerScreenHandler) this.handler).slots.get(0);
    this.onMouseClick(outputSlot, outputSlot.id, 0, SlotActionType.THROW);
}
Also used : Slot(net.minecraft.screen.slot.Slot) PlayerScreenHandler(net.minecraft.screen.PlayerScreenHandler)

Aggregations

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