Search in sources :

Example 1 with ICloneable

use of de.siphalor.nbtcrafting.util.duck.ICloneable in project nbt-crafting by Siphalor.

the class MixinIngredient method ofAdvancedEntries.

@Unique
private static Ingredient ofAdvancedEntries(Stream<? extends IngredientEntry> entries) {
    if (entries == null)
        NbtCrafting.logError("Internal error: can't construct ingredient from null entry stream!");
    try {
        Ingredient ingredient;
        // noinspection ConstantConditions
        ingredient = (Ingredient) ((ICloneable) (Object) Ingredient.EMPTY).clone();
        ((IIngredient) (Object) ingredient).nbtCrafting$setAdvancedEntries(entries);
        return ingredient;
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    return Ingredient.EMPTY;
}
Also used : ICloneable(de.siphalor.nbtcrafting.util.duck.ICloneable) Ingredient(net.minecraft.recipe.Ingredient) Unique(org.spongepowered.asm.mixin.Unique)

Aggregations

ICloneable (de.siphalor.nbtcrafting.util.duck.ICloneable)1 Ingredient (net.minecraft.recipe.Ingredient)1 Unique (org.spongepowered.asm.mixin.Unique)1