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;
}
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));
}
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));
}
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));
}
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;
}
Aggregations