use of com.lothrazar.cyclic.block.crafter.TileCrafter 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;
}
use of com.lothrazar.cyclic.block.crafter.TileCrafter in project Polymorph by TheIllusiveC4.
the class CyclicModule method setup.
@Override
public void setup() {
IPolymorphCommon commonApi = PolymorphApi.common();
commonApi.registerTileEntity2RecipeData(tileEntity -> {
if (tileEntity instanceof TileCrafter) {
return new TileCrafterRecipeData((TileCrafter) tileEntity);
}
return null;
});
commonApi.registerContainer2TileEntity(container -> {
if (container instanceof ContainerCrafter) {
return ((AccessorContainerCrafter) container).getTile();
}
return null;
});
}
Aggregations