Search in sources :

Example 1 with ActionAddRecipe

use of com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe in project BotanyPots by Darkhax-Minecraft.

the class CropManager method create.

@ZenCodeType.Method
public ZenCrop create(String id, IIngredient seed, BlockState[] display, int ticks, String[] categories) {
    final ZenCrop crop = new ZenCrop(id, seed, display, ticks, categories);
    CraftTweakerAPI.apply(new ActionAddRecipe(this, crop.getInternal(), ""));
    return crop;
}
Also used : ActionAddRecipe(com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe)

Example 2 with ActionAddRecipe

use of com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe in project AstralSorcery by HellFirePvP.

the class AltarManager method addRecipe.

@ZenCodeType.Method
public void addRecipe(String name, String altarType, IItemStack output, String[] pattern, Map<String, IIngredient> ingredients, int duration, int starlightRequired) {
    name = fixRecipeName(name);
    if (Arrays.stream(AltarType.values()).map(Enum::name).noneMatch(s -> s.equalsIgnoreCase(altarType))) {
        throw new IllegalArgumentException("Unknown Astral Sorcery Altar Type: " + altarType);
    }
    if (pattern.length != 5) {
        throw new IllegalArgumentException("Astral Sorcery Altar ingredients needs to be a 5x5 array with all values filled.");
    }
    if (ingredients.keySet().stream().anyMatch(s -> s.length() != 1)) {
        throw new IllegalArgumentException("Cannot have multiple characters as pattern key!");
    }
    AltarRecipeGrid.Builder builder = AltarRecipeGrid.builder();
    for (String strings : pattern) {
        builder.patternLine(strings);
    }
    for (String character : ingredients.keySet()) {
        builder.key(character.charAt(0), ingredients.get(character).asVanillaIngredient());
    }
    SimpleAltarRecipe recipe = new SimpleAltarRecipe(new ResourceLocation(name), AltarType.valueOf(altarType.toUpperCase()), duration, starlightRequired, builder.build());
    recipe.addOutput(output.getInternal());
    CraftTweakerAPI.apply(new ActionAddRecipe(this, recipe));
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) ActionAddRecipe(com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe) AltarRecipeGrid(hellfirepvp.astralsorcery.common.crafting.recipe.altar.AltarRecipeGrid) SimpleAltarRecipe(hellfirepvp.astralsorcery.common.crafting.recipe.SimpleAltarRecipe)

Example 3 with ActionAddRecipe

use of com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe in project AstralSorcery by HellFirePvP.

the class AltarManager method addRecipe.

@ZenCodeType.Method
public void addRecipe(String name, String altarType, IItemStack output, IIngredient[][] ingredients, int duration, int starlightRequired) {
    name = fixRecipeName(name);
    if (Arrays.stream(AltarType.values()).map(Enum::name).noneMatch(s -> s.equalsIgnoreCase(altarType))) {
        throw new IllegalArgumentException("Unknown Astral Sorcery Altar Type: " + altarType);
    }
    if (ingredients.length != 5) {
        throw new IllegalArgumentException("Astral Sorcery Altar ingredients needs to be a 5x5 array with all values filled. Use <item:minecraft:air> to pad it out!");
    }
    for (IIngredient[] ingredient : ingredients) {
        if (ingredient.length != 5) {
            throw new IllegalArgumentException("Astral Sorcery Altar ingredients needs to be a 5x5 array with all values filled. Use <item:minecraft:air> to pad it out!");
        }
    }
    AltarRecipeGrid.Builder builder = AltarRecipeGrid.builder();
    builder.patternLine("ABCDE").patternLine("FGHIJ").patternLine("KLMNO").patternLine("PQRST").patternLine("UVWXY");
    int index = 'A';
    for (IIngredient[] ingredient : ingredients) {
        for (IIngredient iIngredient : ingredient) {
            builder.key((char) (index), iIngredient.asVanillaIngredient());
            index++;
        }
    }
    SimpleAltarRecipe recipe = new SimpleAltarRecipe(new ResourceLocation(name), AltarType.valueOf(altarType.toUpperCase()), duration, starlightRequired, builder.build());
    recipe.addOutput(output.getInternal());
    CraftTweakerAPI.apply(new ActionAddRecipe(this, recipe));
}
Also used : IIngredient(com.blamejared.crafttweaker.api.item.IIngredient) ResourceLocation(net.minecraft.util.ResourceLocation) ActionAddRecipe(com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe) AltarRecipeGrid(hellfirepvp.astralsorcery.common.crafting.recipe.altar.AltarRecipeGrid) SimpleAltarRecipe(hellfirepvp.astralsorcery.common.crafting.recipe.SimpleAltarRecipe)

Example 4 with ActionAddRecipe

use of com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe in project AstralSorcery by HellFirePvP.

the class BlockTransmutationManager method addTransmutation.

private void addTransmutation(String name, BlockState outState, double starlight, @ZenCodeType.Optional("null") ResourceLocation constellationKey, Consumer<BlockTransmutation> addInputRequirements) {
    name = fixRecipeName(name);
    IWeakConstellation weakConstellation = null;
    if (constellationKey != null) {
        if (!RegistriesAS.REGISTRY_CONSTELLATIONS.containsKey(constellationKey)) {
            throw new IllegalArgumentException("Invalid constellation key: \"" + constellationKey + "\"");
        }
        IConstellation constellation = RegistriesAS.REGISTRY_CONSTELLATIONS.getValue(constellationKey);
        if (constellation instanceof IWeakConstellation) {
            weakConstellation = (IWeakConstellation) constellation;
        } else {
            throw new IllegalArgumentException("Constellation: \"" + constellationKey + "\" is not a weak constellation!");
        }
    }
    BlockTransmutation transmutation = new BlockTransmutation(new ResourceLocation(name), outState, starlight, weakConstellation);
    CraftTweakerAPI.apply(new ActionAddRecipe(this, transmutation));
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) ActionAddRecipe(com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe) BlockTransmutation(hellfirepvp.astralsorcery.common.crafting.recipe.BlockTransmutation) IWeakConstellation(hellfirepvp.astralsorcery.common.constellation.IWeakConstellation) IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation)

Example 5 with ActionAddRecipe

use of com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe in project BotanyPots by Darkhax-Minecraft.

the class FertilizerManager method create.

@ZenCodeType.Method
public ZenFertilizer create(String id, IIngredient input, int min, int max) {
    final ZenFertilizer fertilizer = new ZenFertilizer(id, input, min, max);
    CraftTweakerAPI.apply(new ActionAddRecipe(this, fertilizer.getInternal(), ""));
    return fertilizer;
}
Also used : ActionAddRecipe(com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe)

Aggregations

ActionAddRecipe (com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe)6 ResourceLocation (net.minecraft.util.ResourceLocation)3 SimpleAltarRecipe (hellfirepvp.astralsorcery.common.crafting.recipe.SimpleAltarRecipe)2 AltarRecipeGrid (hellfirepvp.astralsorcery.common.crafting.recipe.altar.AltarRecipeGrid)2 IIngredient (com.blamejared.crafttweaker.api.item.IIngredient)1 IConstellation (hellfirepvp.astralsorcery.common.constellation.IConstellation)1 IWeakConstellation (hellfirepvp.astralsorcery.common.constellation.IWeakConstellation)1 BlockTransmutation (hellfirepvp.astralsorcery.common.crafting.recipe.BlockTransmutation)1