mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
allow generic ingredients in CraftTweaker and also add documentation
Closes #31
This commit is contained in:
parent
f15ad75c2e
commit
66f34dd8e7
5 changed files with 46 additions and 17 deletions
27
CraftTweakerCompat.md
Normal file
27
CraftTweakerCompat.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Editing Nature's Aura recipes with CraftTweaker
|
||||||
|
A few notes that apply for most of the recipe types:
|
||||||
|
- If you don't know how the CraftTweaker syntax works, [read up on it](https://docs.blamejared.com/en/#Getting_Started/) first.
|
||||||
|
- `name` is the name of a recipe, it can really be anything, but cannot clash with existing recipe names
|
||||||
|
- `IIngredient` is any kind of ingredient, meaning either an OreDictionary entry or an item
|
||||||
|
- `IItemStack` is an item
|
||||||
|
- `aura` is the amount of Aura required and represents the total amount required for the completion of the recipe (for reference, 1,000,000 is the default amount of Aura present in the world and 2,000,000 is the amount that is required for the Environmental Eye's bar to fill up fully)
|
||||||
|
- `time` is the time processes take in ticks
|
||||||
|
|
||||||
|
## Natural Altar
|
||||||
|
`mods.naturesaura.Altar.addRecipe(String name, IIngredient input, IItemStack output, IIngredient catalyst, int aura, int time)`
|
||||||
|
|
||||||
|
- `catalyst` is the catalyst block that is placed on one of the four corner blocks, can be `null`
|
||||||
|
|
||||||
|
## Altar of Birthing
|
||||||
|
`mods.naturesaura.AnimalSpawner.addRecipe(String name, String entity, int aura, int time, IIngredient[] ingredients)`
|
||||||
|
- `entity` is the registry name of the entity that you want to spawn
|
||||||
|
|
||||||
|
## Offering to the Gods
|
||||||
|
`mods.naturesaura.Offering.addRecipe(String name, IIngredient input, int inputAmount, IIngredient startItem, IItemStack output)`
|
||||||
|
- `inputAmount` is the amount of items required for the input. Note that this means that the amount of the `input` variable is ignored
|
||||||
|
- `startItem` is the item required to start the offering, should pretty much always be `naturesaura:calling_spirit`
|
||||||
|
|
||||||
|
## Ritual of the Forest
|
||||||
|
`mods.naturesaura.TreeRitual.addRecipe(String name, IIngredient saplingType, IItemStack result, int time, IIngredient[] items)`
|
||||||
|
- `saplingType` is an item representation of the sapling that needs to be placed and grown into a tree
|
||||||
|
- `items` are the items that need to be placed on the wooden stands
|
|
@ -5,13 +5,13 @@ import com.blamejared.mtlib.helpers.LogHelper;
|
||||||
import com.blamejared.mtlib.utils.BaseMapAddition;
|
import com.blamejared.mtlib.utils.BaseMapAddition;
|
||||||
import com.blamejared.mtlib.utils.BaseMapRemoval;
|
import com.blamejared.mtlib.utils.BaseMapRemoval;
|
||||||
import crafttweaker.annotations.ZenRegister;
|
import crafttweaker.annotations.ZenRegister;
|
||||||
|
import crafttweaker.api.item.IIngredient;
|
||||||
import crafttweaker.api.item.IItemStack;
|
import crafttweaker.api.item.IItemStack;
|
||||||
|
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.api.recipes.AltarRecipe;
|
import de.ellpeck.naturesaura.api.recipes.AltarRecipe;
|
||||||
import de.ellpeck.naturesaura.api.recipes.ing.NBTIngredient;
|
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import stanhebben.zenscript.annotations.ZenClass;
|
import stanhebben.zenscript.annotations.ZenClass;
|
||||||
import stanhebben.zenscript.annotations.ZenMethod;
|
import stanhebben.zenscript.annotations.ZenMethod;
|
||||||
|
@ -25,13 +25,13 @@ import java.util.Map;
|
||||||
public final class AltarTweaker {
|
public final class AltarTweaker {
|
||||||
|
|
||||||
@ZenMethod
|
@ZenMethod
|
||||||
public static void addRecipe(String name, IItemStack input, IItemStack output, IItemStack catalyst, int aura, int time) {
|
public static void addRecipe(String name, IIngredient input, IItemStack output, IIngredient catalyst, int aura, int time) {
|
||||||
CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> {
|
CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> {
|
||||||
ResourceLocation res = new ResourceLocation(name);
|
ResourceLocation res = new ResourceLocation(name);
|
||||||
return new Add(Collections.singletonMap(res, new AltarRecipe(res,
|
return new Add(Collections.singletonMap(res, new AltarRecipe(res,
|
||||||
new NBTIngredient(InputHelper.toStack(input)),
|
CraftTweakerMC.getIngredient(input),
|
||||||
InputHelper.toStack(output),
|
InputHelper.toStack(output),
|
||||||
Ingredient.fromStacks(InputHelper.toStack(catalyst)),
|
CraftTweakerMC.getIngredient(catalyst),
|
||||||
aura, time)));
|
aura, time)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package de.ellpeck.naturesaura.compat.crafttweaker;
|
package de.ellpeck.naturesaura.compat.crafttweaker;
|
||||||
|
|
||||||
import com.blamejared.mtlib.helpers.InputHelper;
|
|
||||||
import com.blamejared.mtlib.utils.BaseMapAddition;
|
import com.blamejared.mtlib.utils.BaseMapAddition;
|
||||||
import com.blamejared.mtlib.utils.BaseMapRemoval;
|
import com.blamejared.mtlib.utils.BaseMapRemoval;
|
||||||
import crafttweaker.annotations.ZenRegister;
|
import crafttweaker.annotations.ZenRegister;
|
||||||
import crafttweaker.api.item.IItemStack;
|
import crafttweaker.api.item.IIngredient;
|
||||||
|
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
|
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
|
||||||
|
@ -22,11 +22,11 @@ import java.util.Map;
|
||||||
public final class AnimalSpawnerTweaker {
|
public final class AnimalSpawnerTweaker {
|
||||||
|
|
||||||
@ZenMethod
|
@ZenMethod
|
||||||
public static void addRecipe(String name, String entity, int aura, int time, IItemStack[] ingredients) {
|
public static void addRecipe(String name, String entity, int aura, int time, IIngredient[] ingredients) {
|
||||||
CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> {
|
CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> {
|
||||||
ResourceLocation res = new ResourceLocation(name);
|
ResourceLocation res = new ResourceLocation(name);
|
||||||
return new Add(Collections.singletonMap(res, new AnimalSpawnerRecipe(res, new ResourceLocation(entity), aura, time,
|
return new Add(Collections.singletonMap(res, new AnimalSpawnerRecipe(res, new ResourceLocation(entity), aura, time,
|
||||||
Arrays.stream(ingredients).map(ing -> Ingredient.fromStacks(InputHelper.toStack(ing))).toArray(Ingredient[]::new)
|
Arrays.stream(ingredients).map(CraftTweakerMC::getIngredient).toArray(Ingredient[]::new)
|
||||||
)));
|
)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,14 @@ import com.blamejared.mtlib.helpers.LogHelper;
|
||||||
import com.blamejared.mtlib.utils.BaseMapAddition;
|
import com.blamejared.mtlib.utils.BaseMapAddition;
|
||||||
import com.blamejared.mtlib.utils.BaseMapRemoval;
|
import com.blamejared.mtlib.utils.BaseMapRemoval;
|
||||||
import crafttweaker.annotations.ZenRegister;
|
import crafttweaker.annotations.ZenRegister;
|
||||||
|
import crafttweaker.api.item.IIngredient;
|
||||||
import crafttweaker.api.item.IItemStack;
|
import crafttweaker.api.item.IItemStack;
|
||||||
|
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.api.recipes.OfferingRecipe;
|
import de.ellpeck.naturesaura.api.recipes.OfferingRecipe;
|
||||||
import de.ellpeck.naturesaura.api.recipes.ing.AmountIngredient;
|
import de.ellpeck.naturesaura.api.recipes.ing.AmountIngredient;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import stanhebben.zenscript.annotations.ZenClass;
|
import stanhebben.zenscript.annotations.ZenClass;
|
||||||
import stanhebben.zenscript.annotations.ZenMethod;
|
import stanhebben.zenscript.annotations.ZenMethod;
|
||||||
|
@ -25,12 +26,12 @@ import java.util.Map;
|
||||||
public final class OfferingTweaker {
|
public final class OfferingTweaker {
|
||||||
|
|
||||||
@ZenMethod
|
@ZenMethod
|
||||||
public static void addRecipe(String name, IItemStack input, IItemStack startItem, IItemStack output) {
|
public static void addRecipe(String name, IIngredient input, int inputAmount, IIngredient startItem, IItemStack output) {
|
||||||
CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> {
|
CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> {
|
||||||
ResourceLocation res = new ResourceLocation(name);
|
ResourceLocation res = new ResourceLocation(name);
|
||||||
return new Add(Collections.singletonMap(res, new OfferingRecipe(res,
|
return new Add(Collections.singletonMap(res, new OfferingRecipe(res,
|
||||||
new AmountIngredient(InputHelper.toStack(input)),
|
new AmountIngredient(CraftTweakerMC.getIngredient(input), inputAmount),
|
||||||
Ingredient.fromStacks(InputHelper.toStack(startItem)),
|
CraftTweakerMC.getIngredient(startItem),
|
||||||
InputHelper.toStack(output))));
|
InputHelper.toStack(output))));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,13 @@ import com.blamejared.mtlib.helpers.LogHelper;
|
||||||
import com.blamejared.mtlib.utils.BaseMapAddition;
|
import com.blamejared.mtlib.utils.BaseMapAddition;
|
||||||
import com.blamejared.mtlib.utils.BaseMapRemoval;
|
import com.blamejared.mtlib.utils.BaseMapRemoval;
|
||||||
import crafttweaker.annotations.ZenRegister;
|
import crafttweaker.annotations.ZenRegister;
|
||||||
|
import crafttweaker.api.item.IIngredient;
|
||||||
import crafttweaker.api.item.IItemStack;
|
import crafttweaker.api.item.IItemStack;
|
||||||
|
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||||
import de.ellpeck.naturesaura.Helper;
|
import de.ellpeck.naturesaura.Helper;
|
||||||
import de.ellpeck.naturesaura.NaturesAura;
|
import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||||
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe;
|
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe;
|
||||||
import de.ellpeck.naturesaura.api.recipes.ing.NBTIngredient;
|
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import stanhebben.zenscript.annotations.ZenClass;
|
import stanhebben.zenscript.annotations.ZenClass;
|
||||||
|
@ -26,14 +27,14 @@ import java.util.Map;
|
||||||
public final class TreeRitualTweaker {
|
public final class TreeRitualTweaker {
|
||||||
|
|
||||||
@ZenMethod
|
@ZenMethod
|
||||||
public static void addRecipe(String name, IItemStack saplingType, IItemStack result, int time, IItemStack[] items) {
|
public static void addRecipe(String name, IIngredient saplingType, IItemStack result, int time, IIngredient[] items) {
|
||||||
CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> {
|
CraftTweakerCompat.SCHEDULED_ACTIONS.add(() -> {
|
||||||
ResourceLocation res = new ResourceLocation(name);
|
ResourceLocation res = new ResourceLocation(name);
|
||||||
return new Add(Collections.singletonMap(res, new TreeRitualRecipe(res,
|
return new Add(Collections.singletonMap(res, new TreeRitualRecipe(res,
|
||||||
Ingredient.fromStacks(InputHelper.toStack(saplingType)),
|
CraftTweakerMC.getIngredient(saplingType),
|
||||||
InputHelper.toStack(result),
|
InputHelper.toStack(result),
|
||||||
time,
|
time,
|
||||||
Arrays.stream(items).map(item -> new NBTIngredient(InputHelper.toStack(item))).toArray(Ingredient[]::new)
|
Arrays.stream(items).map(CraftTweakerMC::getIngredient).toArray(Ingredient[]::new)
|
||||||
)));
|
)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue