Search in sources :

Example 6 with Ingredient

use of net.minecraft.recipe.Ingredient in project nbt-crafting by Siphalor.

the class MixinRecipeFinder$Filter method method_7422.

/**
 * @reason Builds the idToAmountMap but with calls to ingredient matches
 * @author Siphalor
 */
@Overwrite
private int[] method_7422() {
    owner = NbtCrafting.lastRecipeFinder;
    IntCollection ints = new IntAVLTreeSet();
    for (int id : owner.idToAmountMap.keySet()) {
        for (Ingredient ingredient : ingredients) {
            if (ingredient.test(RecipeFinder.getStackFromId(id)))
                ints.add(id);
        }
    }
    return ints.toIntArray();
}
Also used : Ingredient(net.minecraft.recipe.Ingredient) IntCollection(it.unimi.dsi.fastutil.ints.IntCollection) IntAVLTreeSet(it.unimi.dsi.fastutil.ints.IntAVLTreeSet)

Example 7 with Ingredient

use of net.minecraft.recipe.Ingredient in project nbt-crafting by Siphalor.

the class CauldronRecipe method from.

public static CauldronRecipe from(PacketByteBuf packetByteBuf) {
    Identifier identifier = packetByteBuf.readIdentifier();
    Ingredient input = Ingredient.fromPacket(packetByteBuf);
    ItemStack output = packetByteBuf.readItemStack();
    int levels = packetByteBuf.readShort();
    return new CauldronRecipe(identifier, input, output, levels);
}
Also used : Identifier(net.minecraft.util.Identifier) Ingredient(net.minecraft.recipe.Ingredient) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Ingredient (net.minecraft.recipe.Ingredient)7 ItemStack (net.minecraft.item.ItemStack)4 ICloneable (de.siphalor.nbtcrafting.util.duck.ICloneable)1 IntAVLTreeSet (it.unimi.dsi.fastutil.ints.IntAVLTreeSet)1 IntCollection (it.unimi.dsi.fastutil.ints.IntCollection)1 ArrayList (java.util.ArrayList)1 IngredientAccess (mod.azure.doom.mixin.IngredientAccess)1 GunTableRecipe (mod.azure.doom.util.recipes.GunTableRecipe)1 ExperienceOrbEntity (net.minecraft.entity.ExperienceOrbEntity)1 ItemEntity (net.minecraft.entity.ItemEntity)1 Identifier (net.minecraft.util.Identifier)1 Box (net.minecraft.util.math.Box)1 Unique (org.spongepowered.asm.mixin.Unique)1