Search in sources :

Example 1 with AccessorTileCrafter

use of top.theillusivec4.polymorph.mixin.integration.cyclic.AccessorTileCrafter in project Polymorph by TheIllusiveC4.

the class CyclicModule method selectRecipe.

@SuppressWarnings("ConstantConditions")
@Override
public boolean selectRecipe(BlockEntity tileEntity, Recipe<?> recipe) {
    if (tileEntity instanceof TileCrafter) {
        AccessorTileCrafter tileCrafter = (AccessorTileCrafter) tileEntity;
        tileCrafter.setLastValidRecipe(recipe);
        tileCrafter.setRecipeOutput(recipe.getResultItem());
        LazyOptional<IItemHandler> preview = tileCrafter.getPreview();
        if (preview != null) {
            tileCrafter.callSetPreviewSlot(preview.orElse(null), recipe.getResultItem());
        }
        return true;
    }
    return false;
}
Also used : AccessorTileCrafter(top.theillusivec4.polymorph.mixin.integration.cyclic.AccessorTileCrafter) IItemHandler(net.minecraftforge.items.IItemHandler) AccessorTileCrafter(top.theillusivec4.polymorph.mixin.integration.cyclic.AccessorTileCrafter) TileCrafter(com.lothrazar.cyclic.block.crafter.TileCrafter)

Aggregations

TileCrafter (com.lothrazar.cyclic.block.crafter.TileCrafter)1 IItemHandler (net.minecraftforge.items.IItemHandler)1 AccessorTileCrafter (top.theillusivec4.polymorph.mixin.integration.cyclic.AccessorTileCrafter)1