version update, closes #354
This commit is contained in:
parent
e43a9f482d
commit
1deff335ea
44 changed files with 2487 additions and 55 deletions
|
@ -32,7 +32,10 @@ minecraft {
|
|||
replace "@modVersion@", config.mod.version
|
||||
mappings = "snapshot_20160518"
|
||||
}
|
||||
|
||||
sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly.
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = "1.8"
|
||||
}
|
||||
repositories {
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
minecraft.version=1.10.2
|
||||
forge.version=1.10.2-12.18.0.2005-1.10.0
|
||||
|
||||
mod.version=2.0.1
|
||||
mod.version=2.0.2
|
BIN
libs/Baubles-1.9.4-1.2.1.0.jar
Normal file
BIN
libs/Baubles-1.9.4-1.2.1.0.jar
Normal file
Binary file not shown.
BIN
libs/Botania-unofficial.r1.8-320.jar
Normal file
BIN
libs/Botania-unofficial.r1.8-320.jar
Normal file
Binary file not shown.
BIN
libs/Chisel_DEV-MC1.9.4-0.0.6.40.jar
Normal file
BIN
libs/Chisel_DEV-MC1.9.4-0.0.6.40.jar
Normal file
Binary file not shown.
|
@ -44,9 +44,9 @@ public class ModTweaker {
|
|||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
logger.info("Starting Initialization for " + ModProps.modid);
|
||||
TweakerPlugin.register("forestry", true, Forestry.class);
|
||||
TweakerPlugin.register("tconstruct", true, TConstruct.class);
|
||||
TweakerPlugin.register("randomthings", true, RandomThings.class);
|
||||
TweakerPlugin.register("forestry", Forestry.class);
|
||||
TweakerPlugin.register("tconstruct", TConstruct.class);
|
||||
TweakerPlugin.register("randomthings", RandomThings.class);
|
||||
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
||||
|
|
|
@ -63,6 +63,23 @@ public class StackHelper {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds extra check to IIngredient matches() for Botania special flowers
|
||||
*/
|
||||
public static boolean matches(IIngredient ingredient, IItemStack[] itemStack) {
|
||||
if(ingredient == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (IItemStack stack : itemStack) {
|
||||
if(!ingredient.matches(stack)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function compares an ingredient with a fluid. MCLiquidStack.matches() function
|
||||
|
|
27
src/main/java/modtweaker/mods/botania/Botania.java
Normal file
27
src/main/java/modtweaker/mods/botania/Botania.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package modtweaker.mods.botania;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.botania.handlers.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
public class Botania {
|
||||
public Botania() {
|
||||
MineTweakerAPI.registerClass(Apothecary.class);
|
||||
MineTweakerAPI.registerClass(Brew.class);
|
||||
MineTweakerAPI.registerClass(ElvenTrade.class);
|
||||
MineTweakerAPI.registerClass(ManaInfusion.class);
|
||||
MineTweakerAPI.registerClass(Orechid.class);
|
||||
MineTweakerAPI.registerClass(PureDaisy.class);
|
||||
MineTweakerAPI.registerClass(RuneAltar.class);
|
||||
MineTweakerAPI.registerClass(Lexicon.class);
|
||||
}
|
||||
|
||||
public static boolean isSubtile(ItemStack stack) {
|
||||
return stack.getItem() instanceof ItemBlockSpecialFlower;
|
||||
}
|
||||
|
||||
public static boolean subtileMatches(ItemStack stack, ItemStack stack2) {
|
||||
return (ItemBlockSpecialFlower.getType(stack2).equals(ItemBlockSpecialFlower.getType(stack)));
|
||||
}
|
||||
}
|
34
src/main/java/modtweaker/mods/botania/BotaniaHelper.java
Normal file
34
src/main/java/modtweaker/mods/botania/BotaniaHelper.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package modtweaker.mods.botania;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BotaniaHelper {
|
||||
public static LexiconCategory findCatagory(String name) {
|
||||
List<LexiconCategory> catagories = BotaniaAPI.getAllCategories();
|
||||
for (int i = 0; i < catagories.size(); i++) {
|
||||
if (catagories.get(i).getUnlocalizedName().equalsIgnoreCase(name))
|
||||
return catagories.get(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LexiconEntry findEntry(String name) {
|
||||
List<LexiconEntry> entries = BotaniaAPI.getAllEntries();
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
if (entries.get(i).getUnlocalizedName().equalsIgnoreCase(name))
|
||||
return entries.get(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static KnowledgeType findKnowledgeType(String name) {
|
||||
if (BotaniaAPI.knowledgeTypes.containsKey(name))
|
||||
return BotaniaAPI.knowledgeTypes.get(name);
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package modtweaker.mods.botania.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class BotaniaBrewLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
Set<String> brew_keys=BotaniaAPI.brewMap.keySet();
|
||||
System.out.println("Brews: " + brew_keys.size());
|
||||
for (String key : brew_keys) {
|
||||
System.out.println("Brew " + key);
|
||||
MineTweakerAPI.logCommand(key);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package modtweaker.mods.botania.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.helpers.LogHelper;
|
||||
import modtweaker.helpers.StringHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class BotaniaLogger implements ICommandFunction {
|
||||
|
||||
private static final List<String> validArguments = new LinkedList<String>();
|
||||
|
||||
static {
|
||||
validArguments.add("Apothecary");
|
||||
validArguments.add("Brew");
|
||||
validArguments.add("ElvenTrade");
|
||||
validArguments.add("ManaInfusion");
|
||||
validArguments.add("PureDaisy");
|
||||
validArguments.add("RuneAltar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
List<String> args = StringHelper.toLowerCase(Arrays.asList(arguments));
|
||||
|
||||
if(!validArguments.containsAll(args)) {
|
||||
if(player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("Invalid arguments for command. Valid arguments: " + StringHelper.join(validArguments, ", ")));
|
||||
}
|
||||
} else {
|
||||
if(args.isEmpty() || args.contains("Apothecary")) {
|
||||
for(RecipePetals recipe : BotaniaAPI.petalRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botania.Apothecary.addRecipe(%s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
LogHelper.getListDescription(recipe.getInputs()) // Need to resolve "petalXXX" to an item
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("Brew")) {
|
||||
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botania.Brew.addRecipe(%s, \"%s\");",
|
||||
LogHelper.getListDescription(recipe.getInputs()),
|
||||
recipe.getBrew().getKey()));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("ElvenTrade")) {
|
||||
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botania.ElvenTrade.addRecipe(%s, %s);",
|
||||
//TODO CHECK THIS
|
||||
LogHelper.getStackDescription(recipe.getOutputs()),
|
||||
LogHelper.getListDescription(recipe.getInputs()
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("ManaInfusion")) {
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botania.ManaInfusion.add%s(%s, %s, %d);",
|
||||
recipe.isAlchemy() ? "Alchemy" : recipe.isConjuration() ? "Conjuration" : "Infusion",
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
LogHelper.getStackDescription(recipe.getInput()),
|
||||
recipe.getManaToConsume()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("PureDaisy")) {
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botania.PureDaisy.addRecipe(%s, %s);",
|
||||
LogHelper.getStackDescription(recipe.getInput()),
|
||||
//TODO CHECK THIS
|
||||
LogHelper.getStackDescription(new ItemStack(recipe.getOutputState().getBlock(), 1))));
|
||||
}
|
||||
}
|
||||
|
||||
if(args.isEmpty() || args.contains("RuneAltar")) {
|
||||
for(RecipeRuneAltar recipe : BotaniaAPI.runeAltarRecipes) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.botania.RuneAltar.addRecipe(%s, %s, %d);",
|
||||
LogHelper.getStackDescription(recipe.getOutput()),
|
||||
LogHelper.getListDescription(recipe.getInputs()),
|
||||
recipe.getManaUsage()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package modtweaker.mods.botania.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class BotaniaOrechidLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
|
||||
Set<String> keys = BotaniaAPI.oreWeights.keySet();
|
||||
System.out.println("Orechid Keys: " + keys.size());
|
||||
for (String str : BotaniaAPI.oreWeights.keySet()) {
|
||||
System.out.println("Orechid Key: " + str);
|
||||
MineTweakerAPI.logCommand(str + ": " + BotaniaAPI.oreWeights.get(str) + "\n");
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.helpers.LogHelper;
|
||||
import modtweaker.utils.BaseListAddition;
|
||||
import modtweaker.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.*;
|
||||
import static modtweaker.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.botania.Apothecary")
|
||||
public class Apothecary {
|
||||
|
||||
protected static final String name = "Botania Petal";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient[] input) {
|
||||
MineTweakerAPI.apply(new Add(new RecipePetals(toStack(output), toObjects(input))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(String output, IIngredient[] input) {
|
||||
addRecipe(toIItemStack(ItemBlockSpecialFlower.ofType(output)), input);
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipePetals> {
|
||||
public Add(RecipePetals recipe) {
|
||||
super("Botania Petal", BotaniaAPI.petalRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(RecipePetals recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
// Get list of existing recipes, matching with parameter
|
||||
LinkedList<RecipePetals> result = new LinkedList<RecipePetals>();
|
||||
|
||||
for(RecipePetals entry : BotaniaAPI.petalRecipes) {
|
||||
if(entry != null && entry.getOutput() != null && matches(output, toIItemStack(entry.getOutput()))) {
|
||||
result.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we found the recipes and apply the action
|
||||
if(!result.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(result));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", Apothecary.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(String output) {
|
||||
removeRecipe(toIItemStack(ItemBlockSpecialFlower.ofType(output)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipePetals> {
|
||||
public Remove(List<RecipePetals> recipes) {
|
||||
super(Apothecary.name, BotaniaAPI.petalRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(RecipePetals recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
}
|
88
src/main/java/modtweaker/mods/botania/handlers/Brew.java
Normal file
88
src/main/java/modtweaker/mods/botania/handlers/Brew.java
Normal file
|
@ -0,0 +1,88 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import modtweaker.helpers.InputHelper;
|
||||
import modtweaker.helpers.LogHelper;
|
||||
import modtweaker.helpers.StringHelper;
|
||||
import modtweaker.utils.BaseListAddition;
|
||||
import modtweaker.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ZenClass("mods.botania.Brew")
|
||||
public class Brew {
|
||||
|
||||
public static final String name = "Botania Brew";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IIngredient[] inputItems, String brewName) {
|
||||
if(inputItems == null || inputItems.length == 0 || brewName == null || brewName.length() == 0) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!BotaniaAPI.brewMap.containsKey(brewName)) {
|
||||
LogHelper.logError(String.format("Unknown brew name \"%s\" for %s recipe.", brewName, name));
|
||||
}
|
||||
|
||||
RecipeBrew recipe = new RecipeBrew(BotaniaAPI.brewMap.get(brewName), InputHelper.toObjects(inputItems));
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeBrew> {
|
||||
|
||||
protected Add(RecipeBrew recipe) {
|
||||
super(Brew.name, BotaniaAPI.brewRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(RecipeBrew recipe) {
|
||||
return recipe.getBrew().getKey();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(String brewName) {
|
||||
List<RecipeBrew> recipes = new LinkedList<RecipeBrew>();
|
||||
Matcher matcher = Pattern.compile(StringHelper.wildcardToRegex(brewName)).matcher("");
|
||||
|
||||
for(RecipeBrew recipe : BotaniaAPI.brewRecipes) {
|
||||
matcher.reset(recipe.getBrew().getKey());
|
||||
if(matcher.matches()) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s recipe found for %s. Command ignored!", name, brewName));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Remove extends BaseListRemoval<RecipeBrew> {
|
||||
|
||||
protected Remove(List<RecipeBrew> recipes) {
|
||||
super(Brew.name, BotaniaAPI.brewRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(RecipeBrew recipe) {
|
||||
return recipe.getBrew().getKey();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.helpers.LogHelper;
|
||||
import modtweaker.utils.BaseListAddition;
|
||||
import modtweaker.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.toObjects;
|
||||
import static modtweaker.helpers.InputHelper.toStacks;
|
||||
import static modtweaker.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.botania.ElvenTrade")
|
||||
public class ElvenTrade {
|
||||
|
||||
protected static final String name = "Botania Eleven Trade";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack[] outputs, IIngredient[] input) {
|
||||
MineTweakerAPI.apply(new Add(new RecipeElvenTrade(toStacks(outputs), toObjects(input))));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeElvenTrade> {
|
||||
public Add(RecipeElvenTrade recipe) {
|
||||
super(ElvenTrade.name, BotaniaAPI.elvenTradeRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(RecipeElvenTrade recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutputs());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
// Get list of existing recipes, matching with parameter
|
||||
LinkedList<RecipeElvenTrade> recipes = new LinkedList<RecipeElvenTrade>();
|
||||
|
||||
for(RecipeElvenTrade entry : BotaniaAPI.elvenTradeRecipes) {
|
||||
if(entry != null && entry.getOutputs() != null && matches(output, toStacks((IIngredient[]) entry.getOutputs().toArray()))) {
|
||||
recipes.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we found the recipes and apply the action
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ElvenTrade.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipeElvenTrade> {
|
||||
public Remove(List<RecipeElvenTrade> recipes) {
|
||||
super(ElvenTrade.name, BotaniaAPI.elvenTradeRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(RecipeElvenTrade recipe) {
|
||||
//TODO update logging
|
||||
return LogHelper.getStackDescription(recipe.getOutputs());
|
||||
}
|
||||
}
|
||||
}
|
444
src/main/java/modtweaker/mods/botania/handlers/Lexicon.java
Normal file
444
src/main/java/modtweaker/mods/botania/handlers/Lexicon.java
Normal file
|
@ -0,0 +1,444 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.recipes.ShapedRecipe;
|
||||
import minetweaker.mc1102.recipes.RecipeConverter;
|
||||
import modtweaker.mods.botania.BotaniaHelper;
|
||||
import modtweaker.mods.botania.lexicon.*;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.*;
|
||||
import vazkii.botania.api.recipe.*;
|
||||
import vazkii.botania.common.lexicon.page.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.*;
|
||||
|
||||
@ZenClass("mods.botania.Lexicon")
|
||||
public class Lexicon {
|
||||
|
||||
@ZenMethod
|
||||
public static void addBrewPage(String name, String entry, int page_number, String brew, IIngredient[] recipe, String bottomText) {
|
||||
LexiconEntry lexiconEntry= BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(BotaniaAPI.getBrewFromKey(brew)==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find brew "+brew);
|
||||
return;
|
||||
}
|
||||
RecipeBrew page_recipe=new RecipeBrew(BotaniaAPI.getBrewFromKey(brew),toObjects(recipe));
|
||||
LexiconPage page=new PageBrew(page_recipe,name,bottomText);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addCraftingPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][][] inputs) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(outputs.length!=inputs.length)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<IRecipe> recipes=new ArrayList<IRecipe>();
|
||||
for(int i=0;i<outputs.length;i++)
|
||||
{
|
||||
recipes.add(RecipeConverter.convert(new ShapedRecipe(outputs[i],inputs[i],null,false)));
|
||||
}
|
||||
LexiconPage page=new PageCraftingRecipe(name, recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addElvenPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][] inputs) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(outputs.length!=inputs.length)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<RecipeElvenTrade> recipes=new ArrayList<RecipeElvenTrade>();
|
||||
for(int i=0;i<outputs.length;i++)
|
||||
{
|
||||
//TODO test
|
||||
recipes.add(new RecipeElvenTrade(toStacks(outputs),toObjects(inputs[i])));
|
||||
}
|
||||
|
||||
|
||||
LexiconPage page=new PageElvenRecipe(name,recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addEntityPage(String name, String entry, int page_number, String entity, int size) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(!EntityList.isStringValidEntityName(entity))
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("No such entity "+entity);
|
||||
return;
|
||||
}
|
||||
LexiconPage page=new PageEntity(entity, entity, size);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addImagePage(String name, String entry, int page_number, String resource) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
LexiconPage page=new PageImage(name, resource);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addLorePage(String name, String entry, int page_number) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
LexiconPage page=new PageLoreText(name);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addInfusionPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[] inputs, int[] mana) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(outputs.length!=inputs.length || outputs.length!=mana.length)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<RecipeManaInfusion> recipes=new ArrayList<RecipeManaInfusion>();
|
||||
for(int i=0;i<outputs.length;i++)
|
||||
{
|
||||
recipes.add(new RecipeManaInfusion(toStack(outputs[i]),toObject(inputs[i]),mana[i]));
|
||||
}
|
||||
LexiconPage page=new PageManaInfusionRecipe(name,recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addAlchemyPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[] inputs, int[] mana) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(outputs.length!=inputs.length || outputs.length!=mana.length)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<RecipeManaInfusion> recipes=new ArrayList<RecipeManaInfusion>();
|
||||
for(int i=0;i<outputs.length;i++)
|
||||
{
|
||||
RecipeManaInfusion current_recipe=new RecipeManaInfusion(toStack(outputs[i]),toObject(inputs[i]),mana[i]);
|
||||
current_recipe.setAlchemy(true);
|
||||
recipes.add(current_recipe);
|
||||
}
|
||||
LexiconPage page=new PageManaInfusionRecipe(name,recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addConjurationPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[] inputs, int[] mana) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(outputs.length!=inputs.length || outputs.length!=mana.length)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<RecipeManaInfusion> recipes=new ArrayList<RecipeManaInfusion>();
|
||||
for(int i=0;i<outputs.length;i++)
|
||||
{
|
||||
RecipeManaInfusion current_recipe=new RecipeManaInfusion(toStack(outputs[i]),toObject(inputs[i]),mana[i]);
|
||||
current_recipe.setConjuration(true);
|
||||
recipes.add(current_recipe);
|
||||
}
|
||||
LexiconPage page=new PageManaInfusionRecipe(name,recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addPetalPage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][] inputs) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(outputs.length!=inputs.length)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<RecipePetals> recipes=new ArrayList<RecipePetals>();
|
||||
for(int i=0;i<outputs.length;i++)
|
||||
{
|
||||
recipes.add(new RecipePetals(toStack(outputs[i]),toObjects(inputs[i])));
|
||||
}
|
||||
LexiconPage page=new PagePetalRecipe(name,recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRunePage(String name, String entry, int page_number, IItemStack[] outputs, IIngredient[][] inputs, int[] mana) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
if(outputs.length!=inputs.length || outputs.length!=mana.length)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Length of input and output must match");
|
||||
return;
|
||||
}
|
||||
List<RecipeRuneAltar> recipes=new ArrayList<RecipeRuneAltar>();
|
||||
for(int i=0;i<outputs.length;i++)
|
||||
{
|
||||
recipes.add(new RecipeRuneAltar(toStack(outputs[i]),mana[i],toObjects(inputs[i])));
|
||||
}
|
||||
LexiconPage page=new PageRuneRecipe(name,recipes);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addTextPage(String name, String entry, int page_number) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
LexiconPage page=new PageText(name);
|
||||
MineTweakerAPI.apply(new AddPage(name,lexiconEntry,page,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removePage(String entry, int page_number) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(page_number>=lexiconEntry.pages.size())
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Page Number " + page_number + " out of bounds for "+entry);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new RemovePage(lexiconEntry,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addEntry(String entry, String catagory, IItemStack stack) {
|
||||
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(catagory);
|
||||
if(lexiconCategory==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+catagory);
|
||||
return;
|
||||
}
|
||||
LexiconEntry lexiconEntry=new LexiconEntry(entry,lexiconCategory);
|
||||
lexiconEntry.setIcon(toStack(stack));
|
||||
MineTweakerAPI.apply(new AddEntry(lexiconEntry));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeEntry(String entry) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new RemoveEntry(lexiconEntry));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void setEntryKnowledgeType(String entry, String knowledgeType) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
KnowledgeType type=BotaniaHelper.findKnowledgeType(knowledgeType);
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+entry);
|
||||
return;
|
||||
}
|
||||
if(type==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find knowledge type "+knowledgeType);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new SetEntryKnowledgeType(lexiconEntry,type));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addCategory(String name) {
|
||||
LexiconCategory lexiconCategory=new LexiconCategory(name);
|
||||
MineTweakerAPI.apply(new AddCategory(lexiconCategory));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeCategory(String name) {
|
||||
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(name);
|
||||
if(lexiconCategory==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+name);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new RemoveCategory(lexiconCategory));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void setCategoryPriority(String name, int priority) {
|
||||
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(name);
|
||||
if(lexiconCategory==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+name);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new SetCategoryPriority(lexiconCategory,priority));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void setCategoryIcon(String name, String icon) {
|
||||
LexiconCategory lexiconCategory=BotaniaHelper.findCatagory(name);
|
||||
if(lexiconCategory==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon category "+name);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new SetCategoryIcon(lexiconCategory,icon));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipeMapping(IItemStack stack, String Entry, int page) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(Entry);
|
||||
if(LexiconRecipeMappings.getDataForStack(toStack(stack))!=null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("There is already a recipe mapping for "+stack);
|
||||
return;
|
||||
}
|
||||
if(lexiconEntry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find lexicon entry "+Entry);
|
||||
return;
|
||||
}
|
||||
if(lexiconEntry.pages.size()<page)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Not enough pages in "+Entry);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new AddRecipeMapping(toStack(stack),lexiconEntry,page));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipeMapping(IItemStack stack) {
|
||||
if(LexiconRecipeMappings.getDataForStack(toStack(stack))==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("There isn't a recipe mapping for "+stack);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new RemoveRecipeMapping(toStack(stack)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.helpers.LogHelper;
|
||||
import modtweaker.utils.BaseListAddition;
|
||||
import modtweaker.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.toIItemStack;
|
||||
import static modtweaker.helpers.InputHelper.toObject;
|
||||
import static modtweaker.helpers.InputHelper.toStack;
|
||||
import static modtweaker.helpers.StackHelper.matches;
|
||||
|
||||
|
||||
@ZenClass("mods.botania.ManaInfusion")
|
||||
public class ManaInfusion {
|
||||
|
||||
protected static final String name = "Botania Mana Infusion";
|
||||
|
||||
@ZenMethod
|
||||
public static void addInfusion(IItemStack output, IIngredient input, int mana) {
|
||||
MineTweakerAPI.apply(new Add(new RecipeManaInfusion(toStack(output), toObject(input), mana)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addAlchemy(IItemStack output, IIngredient input, int mana) {
|
||||
RecipeManaInfusion recipe = new RecipeManaInfusion(toStack(output), toObject(input), mana);
|
||||
recipe.setAlchemy(true);
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addConjuration(IItemStack output, IIngredient input, int mana) {
|
||||
RecipeManaInfusion recipe = new RecipeManaInfusion(toStack(output), toObject(input), mana);
|
||||
recipe.setConjuration(true);
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeManaInfusion> {
|
||||
public Add(RecipeManaInfusion recipe) {
|
||||
super(ManaInfusion.name, BotaniaAPI.manaInfusionRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(RecipeManaInfusion recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
// Get list of existing recipes, matching with parameter
|
||||
List<RecipeManaInfusion> recipes = new LinkedList<RecipeManaInfusion>();
|
||||
|
||||
for (RecipeManaInfusion r : BotaniaAPI.manaInfusionRecipes) {
|
||||
if (r.getOutput() != null && matches(output, toIItemStack(r.getOutput()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we found the recipes and apply the action
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ManaInfusion.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipeManaInfusion> {
|
||||
public Remove(List<RecipeManaInfusion> recipes) {
|
||||
super(ManaInfusion.name, BotaniaAPI.manaInfusionRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(RecipeManaInfusion recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
}
|
113
src/main/java/modtweaker/mods/botania/handlers/Orechid.java
Normal file
113
src/main/java/modtweaker/mods/botania/handlers/Orechid.java
Normal file
|
@ -0,0 +1,113 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
@ZenClass("mods.botania.Orechid")
|
||||
public class Orechid {
|
||||
@ZenMethod
|
||||
public static void addOre(IOreDictEntry oreDict, int weight) {
|
||||
MineTweakerAPI.apply(new Add(oreDict.getName(), weight));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addOre(String oreDict, int weight) {
|
||||
MineTweakerAPI.apply(new Add(oreDict, weight));
|
||||
}
|
||||
|
||||
private static class Add implements IUndoableAction {
|
||||
String oreDict;
|
||||
int weight;
|
||||
|
||||
public Add(String ore, int prop) {
|
||||
oreDict = ore;
|
||||
weight = prop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
BotaniaAPI.addOreWeight(oreDict, weight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Orechid Ore Weight: " + oreDict + ":" + weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return oreDict != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
BotaniaAPI.oreWeights.remove(oreDict);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Orechid Ore: " + oreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeOre(IOreDictEntry oreDict) {
|
||||
MineTweakerAPI.apply(new Remove(oreDict.getName()));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeOre(String oreDict) {
|
||||
MineTweakerAPI.apply(new Remove(oreDict));
|
||||
}
|
||||
|
||||
private static class Remove implements IUndoableAction {
|
||||
String oreDict;
|
||||
int weight;
|
||||
|
||||
public Remove(String ore) {
|
||||
oreDict = ore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
weight = BotaniaAPI.getOreWeight(oreDict);
|
||||
BotaniaAPI.oreWeights.remove(oreDict);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Orechid Ore: " + oreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return weight > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
BotaniaAPI.addOreWeight(oreDict, weight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Restoring Orechid Ore Weight: " + oreDict + ":" + weight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.helpers.InputHelper;
|
||||
import modtweaker.helpers.LogHelper;
|
||||
import modtweaker.helpers.StackHelper;
|
||||
import modtweaker.utils.BaseListAddition;
|
||||
import modtweaker.utils.BaseListRemoval;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipePureDaisy;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@ZenClass("mods.botania.PureDaisy")
|
||||
public class PureDaisy {
|
||||
|
||||
public static final String name = "Botania PureDaisy";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IIngredient blockInput, IItemStack blockOutput) {
|
||||
if(blockInput == null || blockOutput == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
}
|
||||
|
||||
Object input = InputHelper.toObject(blockInput);
|
||||
|
||||
if(input == null || (input instanceof ItemStack && !InputHelper.isABlock((ItemStack)input))) {
|
||||
LogHelper.logError(String.format("Input must be a block or an oredict entry."));
|
||||
return;
|
||||
}
|
||||
|
||||
if(input instanceof ItemStack) input = Block.getBlockFromItem(((ItemStack)input).getItem());
|
||||
ItemStack output = InputHelper.toStack(blockOutput);
|
||||
|
||||
RecipePureDaisy recipe = new RecipePureDaisy(input, Block.getBlockFromItem(output.getItem()).getDefaultState(), output.getItemDamage());
|
||||
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipePureDaisy> {
|
||||
public Add(RecipePureDaisy recipe) {
|
||||
super(PureDaisy.name, BotaniaAPI.pureDaisyRecipes);
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(RecipePureDaisy recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getOutputState().getBlock(), 1));
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
List<RecipePureDaisy> recipes = new LinkedList<RecipePureDaisy>();
|
||||
|
||||
for(RecipePureDaisy recipe : BotaniaAPI.pureDaisyRecipes) {
|
||||
IItemStack out = InputHelper.toIItemStack(new ItemStack(recipe.getOutputState().getBlock(), 1));
|
||||
|
||||
if(StackHelper.matches(output, out)) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipePureDaisy> {
|
||||
public Remove(List<RecipePureDaisy> recipes) {
|
||||
super(PureDaisy.name, BotaniaAPI.pureDaisyRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(RecipePureDaisy recipe) {
|
||||
return LogHelper.getStackDescription(new ItemStack(recipe.getOutputState().getBlock(), 1));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.helpers.LogHelper;
|
||||
import modtweaker.utils.BaseListAddition;
|
||||
import modtweaker.utils.BaseListRemoval;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.*;
|
||||
import static modtweaker.helpers.StackHelper.matches;
|
||||
|
||||
@ZenClass("mods.botania.RuneAltar")
|
||||
public class RuneAltar {
|
||||
|
||||
protected static final String name = "Botania Rune Altar";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack output, IIngredient[] input, int mana) {
|
||||
MineTweakerAPI.apply(new Add(new RecipeRuneAltar(toStack(output), mana, toObjects(input))));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeRuneAltar> {
|
||||
public Add(RecipeRuneAltar recipe) {
|
||||
super(RuneAltar.name, BotaniaAPI.runeAltarRecipes);
|
||||
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(RecipeRuneAltar recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IIngredient output) {
|
||||
// Get list of existing recipes, matching with parameter
|
||||
List<RecipeRuneAltar> recipes = new LinkedList<RecipeRuneAltar>();
|
||||
|
||||
for (RecipeRuneAltar r : BotaniaAPI.runeAltarRecipes) {
|
||||
if (r != null && r.getOutput() != null && matches(output, toIItemStack(r.getOutput()))) {
|
||||
recipes.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we found the recipes and apply the action
|
||||
if (!recipes.isEmpty()) {
|
||||
MineTweakerAPI.apply(new Remove(recipes));
|
||||
} else {
|
||||
LogHelper.logWarning(String.format("No %s Recipe found for %s. Command ignored!", ElvenTrade.name, output.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval<RecipeRuneAltar> {
|
||||
public Remove(List<RecipeRuneAltar> recipes) {
|
||||
super(RuneAltar.name, BotaniaAPI.runeAltarRecipes, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(RecipeRuneAltar recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
public class AddCategory implements IUndoableAction {
|
||||
|
||||
LexiconCategory category;
|
||||
|
||||
public AddCategory(LexiconCategory category) {
|
||||
this.category=category;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
BotaniaAPI.addCategory(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return category != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Lexicon Category: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Lexicon Category: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
BotaniaAPI.getAllCategories().remove(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
45
src/main/java/modtweaker/mods/botania/lexicon/AddEntry.java
Normal file
45
src/main/java/modtweaker/mods/botania/lexicon/AddEntry.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class AddEntry implements IUndoableAction {
|
||||
|
||||
LexiconEntry Entry;
|
||||
|
||||
public AddEntry(LexiconEntry Entry) {
|
||||
this.Entry=Entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
BotaniaAPI.addEntry(Entry, Entry.category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return Entry != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Lexicon Entry: " + Entry.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Lexicon Entry: " + Entry.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
Entry.category.entries.remove(Entry);
|
||||
BotaniaAPI.getAllEntries().remove(Entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
50
src/main/java/modtweaker/mods/botania/lexicon/AddPage.java
Normal file
50
src/main/java/modtweaker/mods/botania/lexicon/AddPage.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
|
||||
public class AddPage implements IUndoableAction {
|
||||
|
||||
String Name;
|
||||
int page_number;
|
||||
LexiconEntry Entry;
|
||||
LexiconPage page;
|
||||
|
||||
public AddPage(String Name, LexiconEntry Entry, LexiconPage page, int page_number) {
|
||||
this.Name=Name;
|
||||
this.Entry=Entry;
|
||||
this.page=page;
|
||||
this.page_number=page_number;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
Entry.pages.add(page_number, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return Name != null && Entry != null && page != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Lexicon Page: " + Name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Lexicon Page: " + Name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
Entry.pages.remove(page_number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
|
||||
public class AddRecipeMapping implements IUndoableAction {
|
||||
|
||||
ItemStack stack;
|
||||
LexiconEntry entry;
|
||||
int page;
|
||||
|
||||
public AddRecipeMapping(ItemStack stack, LexiconEntry entry, int page) {
|
||||
this.stack =stack;
|
||||
this.entry=entry;
|
||||
this.page=page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
LexiconRecipeMappings.map(stack, entry, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
LexiconRecipeMappings.remove(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
public class RemoveCategory implements IUndoableAction {
|
||||
|
||||
LexiconCategory category;
|
||||
|
||||
public RemoveCategory(LexiconCategory category) {
|
||||
this.category=category;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
BotaniaAPI.getAllCategories().remove(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return category != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Lexicon Category: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Lexicon Category: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
BotaniaAPI.addCategory(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class RemoveEntry implements IUndoableAction {
|
||||
|
||||
LexiconEntry Entry;
|
||||
|
||||
public RemoveEntry(LexiconEntry Entry) {
|
||||
this.Entry=Entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
Entry.category.entries.remove(Entry);
|
||||
BotaniaAPI.getAllEntries().remove(Entry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return Entry != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Lexicon Entry: " + Entry.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Lexicon Entry: " + Entry.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
BotaniaAPI.addEntry(Entry, Entry.category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
|
||||
public class RemovePage implements IUndoableAction {
|
||||
|
||||
int page_number;
|
||||
LexiconEntry Entry;
|
||||
LexiconPage page;
|
||||
|
||||
public RemovePage(LexiconEntry Entry, int page_number) {
|
||||
this.Entry=Entry;
|
||||
this.page_number=page_number;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
this.page=Entry.pages.get(page_number);
|
||||
Entry.pages.remove(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return Entry != null && page != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Lexicon Page: " + Entry.pages.get(page_number).getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Lexicon Page: " + page.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
Entry.pages.add(page_number,page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
|
||||
|
||||
public class RemoveRecipeMapping implements IUndoableAction {
|
||||
|
||||
ItemStack stack;
|
||||
LexiconEntry entry;
|
||||
int page;
|
||||
|
||||
public RemoveRecipeMapping(ItemStack stack) {
|
||||
this.stack =stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
EntryData data=LexiconRecipeMappings.getDataForStack(stack);
|
||||
this.entry=data.entry;
|
||||
this.page=data.page;
|
||||
LexiconRecipeMappings.remove(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Lexicon Recipe Lookup: " + stack.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
LexiconRecipeMappings.map(stack,entry,page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
public class SetCategoryIcon implements IUndoableAction {
|
||||
|
||||
LexiconCategory category;
|
||||
ResourceLocation oldIcon;
|
||||
ResourceLocation newIcon;
|
||||
|
||||
public SetCategoryIcon(LexiconCategory category, String icon) {
|
||||
this.category=category;
|
||||
this.newIcon=new ResourceLocation(icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
oldIcon=category.getIcon();
|
||||
category.setIcon(newIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return category != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Setting Lexicon Category priority: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Unsetting Lexicon Category priority: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
category.setIcon(oldIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
public class SetCategoryPriority implements IUndoableAction {
|
||||
|
||||
LexiconCategory category;
|
||||
int oldPriority;
|
||||
int newPriority;
|
||||
|
||||
public SetCategoryPriority(LexiconCategory category, int priority) {
|
||||
this.category=category;
|
||||
this.newPriority=priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
oldPriority=category.getSortingPriority();
|
||||
category.setPriority(newPriority);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return category != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Setting Lexicon Category priority: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Unsetting Lexicon Category priority: " + category.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
category.setPriority(oldPriority);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
public class SetEntryKnowledgeType implements IUndoableAction {
|
||||
|
||||
LexiconEntry Entry;
|
||||
KnowledgeType newType;
|
||||
KnowledgeType oldType;
|
||||
|
||||
public SetEntryKnowledgeType(LexiconEntry Entry, KnowledgeType type) {
|
||||
this.Entry=Entry;
|
||||
this.newType=type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
oldType=Entry.getKnowledgeType();
|
||||
Entry.setKnowledgeType(newType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return Entry != null && oldType != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Setting Knowledge type for: " + Entry.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Unsetting Knowledge type for: " + Entry.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
Entry.setKnowledgeType(oldType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LexiconCategoryLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
List<LexiconCategory> categories=BotaniaAPI.getAllCategories();
|
||||
System.out.println("Categories: " + categories.size());
|
||||
for (LexiconCategory category : categories) {
|
||||
System.out.println("Category " + category.getUnlocalizedName());
|
||||
MineTweakerAPI.logCommand(category.getUnlocalizedName());
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.mods.botania.BotaniaHelper;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LexiconEntryLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
LexiconCategory category=null;
|
||||
if(arguments.length>0)
|
||||
{
|
||||
category= BotaniaHelper.findCatagory(arguments[0]);
|
||||
if(category==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Category not found (" + arguments[0]+")");
|
||||
return;
|
||||
}
|
||||
}
|
||||
List<LexiconEntry> entries=BotaniaAPI.getAllEntries();
|
||||
System.out.println("Entries: " + entries.size());
|
||||
for (LexiconEntry entry : entries) {
|
||||
if(category==null || entry.category==category)
|
||||
{
|
||||
System.out.println("Entry " + entry.getUnlocalizedName());
|
||||
MineTweakerAPI.logCommand(entry.getUnlocalizedName());
|
||||
}
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class LexiconKnowledgeTypesLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
Set<String> types=BotaniaAPI.knowledgeTypes.keySet();
|
||||
System.out.println("Knowledge Types: " + types.size());
|
||||
for (String key : types) {
|
||||
System.out.println("Knowledge Type " + key);
|
||||
MineTweakerAPI.logCommand(key);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.mods.botania.BotaniaHelper;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LexiconPageLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
LexiconEntry entry=null;
|
||||
if(arguments.length>0)
|
||||
{
|
||||
entry= BotaniaHelper.findEntry(arguments[0]);
|
||||
if(entry==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Entry not found (" + arguments[0]+")");
|
||||
return;
|
||||
}
|
||||
}
|
||||
List<LexiconEntry> entries;
|
||||
List<LexiconPage> pages=new ArrayList();
|
||||
if(entry!=null)
|
||||
pages.addAll(entry.pages);
|
||||
else
|
||||
for (LexiconEntry current_Entry : BotaniaAPI.getAllEntries())
|
||||
pages.addAll(current_Entry.pages);
|
||||
System.out.println("Pages: " + pages.size());
|
||||
|
||||
for (LexiconPage page : pages) {
|
||||
System.out.println("Page " + page.getUnlocalizedName() + " (" + page.getClass() + ")");
|
||||
MineTweakerAPI.logCommand(page.getUnlocalizedName() + " (" + page.getClass() + ")");
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
11
src/main/java/modtweaker/mods/chisel/Chisel.java
Normal file
11
src/main/java/modtweaker/mods/chisel/Chisel.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package modtweaker.mods.chisel;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.chisel.handlers.Groups;
|
||||
|
||||
public class Chisel {
|
||||
public Chisel() {
|
||||
MineTweakerAPI.registerClass(Groups.class);
|
||||
}
|
||||
|
||||
}
|
151
src/main/java/modtweaker/mods/chisel/ChiselHelper.java
Normal file
151
src/main/java/modtweaker/mods/chisel/ChiselHelper.java
Normal file
|
@ -0,0 +1,151 @@
|
|||
package modtweaker.mods.chisel;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import team.chisel.api.carving.CarvingUtils;
|
||||
import team.chisel.api.carving.ICarvingGroup;
|
||||
import team.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.toStack;
|
||||
|
||||
public class ChiselHelper {
|
||||
|
||||
public static ICarvingGroup getGroup(String name) {
|
||||
return CarvingUtils.getChiselRegistry().getGroup(name);
|
||||
}
|
||||
|
||||
public static ICarvingGroup getGroup(IItemStack stack) {
|
||||
return CarvingUtils.getChiselRegistry().getGroup(toStack(stack));
|
||||
}
|
||||
|
||||
public static ICarvingVariation getVariation(IItemStack stack) {
|
||||
ICarvingGroup g = getGroup(stack);
|
||||
if (g != null) {
|
||||
for (ICarvingVariation v : g.getVariations()) {
|
||||
if (v.getStack().isItemEqual(toStack(stack))) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ICarvingVariation makeVariation(IItemStack stack) {
|
||||
return new CarvingVariation(Block.getBlockFromItem(toStack(stack).getItem()));
|
||||
}
|
||||
|
||||
public static ICarvingGroup makeGroup(String name) {
|
||||
return new CarvingGroup(name);
|
||||
}
|
||||
|
||||
public static boolean groupContainsVariation(ICarvingGroup group, ICarvingVariation variation) {
|
||||
for (ICarvingVariation otherVariation : group.getVariations()) {
|
||||
if (otherVariation.getStack().isItemEqual(variation.getStack())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class CarvingVariation implements ICarvingVariation {
|
||||
Block block;
|
||||
|
||||
public CarvingVariation(Block block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getBlockState() {
|
||||
return block.getDefaultState();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return new ItemStack(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 99;
|
||||
}
|
||||
}
|
||||
|
||||
static class CarvingGroup implements ICarvingGroup {
|
||||
private String name;
|
||||
private String sound;
|
||||
private String oreName;
|
||||
|
||||
private List<ICarvingVariation> variations = Lists.newArrayList();
|
||||
|
||||
public CarvingGroup(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<ICarvingVariation> getVariations() {
|
||||
return Lists.newArrayList(variations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addVariation(ICarvingVariation variation) {
|
||||
variations.add(variation);
|
||||
Collections.sort(variations, new Comparator<ICarvingVariation>() {
|
||||
|
||||
@Override
|
||||
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
|
||||
return CarvingUtils.compare(o1, o2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeVariation(ICarvingVariation variation) {
|
||||
ICarvingVariation toRemove = null;
|
||||
for (ICarvingVariation v : variations) {
|
||||
if (v.getStack().isItemEqual(variation.getStack())) {
|
||||
toRemove = v;
|
||||
}
|
||||
}
|
||||
return toRemove == null ? false : variations.remove(toRemove);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSound(String sound) {
|
||||
this.sound = sound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOreName() {
|
||||
return oreName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOreName(String oreName) {
|
||||
this.oreName = oreName;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package modtweaker.mods.chisel.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import team.chisel.api.carving.CarvingUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ChiselGroupLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
List<String> keys = CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
||||
System.out.println("Chisel Groups: " + keys.size());
|
||||
for (String key : keys) {
|
||||
System.out.println("Chisel Group " + key);
|
||||
MineTweakerAPI.logCommand(key);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package modtweaker.mods.chisel.commands;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.mods.chisel.ChiselHelper;
|
||||
import net.minecraft.item.Item;
|
||||
import team.chisel.api.carving.CarvingUtils;
|
||||
import team.chisel.api.carving.ICarvingGroup;
|
||||
import team.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class ChiselVariationLogger implements ICommandFunction {
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
Map<ICarvingVariation, ICarvingGroup> variations = new HashMap<ICarvingVariation, ICarvingGroup>();
|
||||
List<String> keys = CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
||||
if (arguments.length > 0) {
|
||||
ICarvingGroup group = ChiselHelper.getGroup(arguments[0]);
|
||||
if (group == null) {
|
||||
MineTweakerAPI.getLogger().logError("Group not found (" + arguments[0] + ")");
|
||||
return;
|
||||
} else {
|
||||
keys.clear();
|
||||
keys.add(arguments[0]);
|
||||
}
|
||||
}
|
||||
for (String key : keys) {
|
||||
ICarvingGroup group = CarvingUtils.getChiselRegistry().getGroup(key);
|
||||
for (ICarvingVariation variation : group.getVariations())
|
||||
variations.put(variation, group);
|
||||
}
|
||||
System.out.println("Chisel Variations: " + variations.size());
|
||||
for (Entry<ICarvingVariation, ICarvingGroup> entry : variations.entrySet()) {
|
||||
String stringedVariation = "<" + Item.REGISTRY.getNameForObject(Item.getItemFromBlock(entry.getKey().getBlock())) + ":" + entry.getKey().getStack().getItemDamage() + ">";
|
||||
if (arguments.length == 0)
|
||||
stringedVariation += " " + entry.getValue().getName();
|
||||
System.out.println("Chisel Variation " + stringedVariation);
|
||||
MineTweakerAPI.logCommand(stringedVariation);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
233
src/main/java/modtweaker/mods/chisel/handlers/Groups.java
Normal file
233
src/main/java/modtweaker/mods/chisel/handlers/Groups.java
Normal file
|
@ -0,0 +1,233 @@
|
|||
package modtweaker.mods.chisel.handlers;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.mods.chisel.ChiselHelper;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import team.chisel.api.carving.CarvingUtils;
|
||||
import team.chisel.api.carving.ICarvingGroup;
|
||||
import team.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
|
||||
@ZenClass("mods.chisel.Groups")
|
||||
public class Groups {
|
||||
@ZenMethod
|
||||
public static void addVariation(String groupName, IItemStack stack) {
|
||||
ICarvingGroup group= ChiselHelper.getGroup(groupName);
|
||||
ICarvingVariation variation=ChiselHelper.makeVariation(stack);
|
||||
if(group==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find group " + groupName);
|
||||
return;
|
||||
}
|
||||
if(variation==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Can't create variation from " + stack);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new AddVariation(group,variation, stack.toString()));
|
||||
}
|
||||
|
||||
static class AddVariation implements IUndoableAction {
|
||||
|
||||
ICarvingGroup group;
|
||||
ICarvingVariation variation;
|
||||
String variationName;
|
||||
|
||||
public AddVariation(ICarvingGroup group,ICarvingVariation variation, String variationName) {
|
||||
this.group=group;
|
||||
this.variation=variation;
|
||||
this.variationName=variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().addVariation(group.getName(),variation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null && variation != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlockState(),group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void removeVariation(IItemStack stack) {
|
||||
ICarvingVariation variation=ChiselHelper.getVariation(stack);
|
||||
if(variation==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Can't find variation from " + stack);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new RemoveVariation(variation, stack.toString()));
|
||||
}
|
||||
|
||||
|
||||
static class RemoveVariation implements IUndoableAction {
|
||||
|
||||
ICarvingVariation variation;
|
||||
String variationName;
|
||||
ICarvingGroup group;
|
||||
|
||||
public RemoveVariation(ICarvingVariation variation, String variationName) {
|
||||
this.variation=variation;
|
||||
this.variationName=variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
group=CarvingUtils.getChiselRegistry().getGroup(variation.getStack());
|
||||
CarvingUtils.getChiselRegistry().removeVariation(variation.getBlockState(),group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group!= null && variation != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Variation: " + variationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().addVariation(group.getName(),variation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addGroup(String groupName) {
|
||||
ICarvingGroup group=ChiselHelper.getGroup(groupName);
|
||||
if(group!=null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Group already exists " + groupName);
|
||||
return;
|
||||
}
|
||||
group=ChiselHelper.makeGroup(groupName);
|
||||
MineTweakerAPI.apply(new AddGroup(group));
|
||||
}
|
||||
|
||||
static class AddGroup implements IUndoableAction {
|
||||
|
||||
ICarvingGroup group;
|
||||
|
||||
public AddGroup(ICarvingGroup group) {
|
||||
this.group=group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().addGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Adding Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Removing Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeGroup(String groupName) {
|
||||
ICarvingGroup group=ChiselHelper.getGroup(groupName);
|
||||
if(group==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Could not find group " + groupName);
|
||||
return;
|
||||
}
|
||||
MineTweakerAPI.apply(new RemoveGroup(group));
|
||||
}
|
||||
|
||||
static class RemoveGroup implements IUndoableAction {
|
||||
|
||||
ICarvingGroup group;
|
||||
|
||||
public RemoveGroup(ICarvingGroup group) {
|
||||
this.group=group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
CarvingUtils.getChiselRegistry().removeGroup(group.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo() {
|
||||
return group != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe() {
|
||||
return "Removing Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo() {
|
||||
return "Adding Group: " + group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
CarvingUtils.getChiselRegistry().addGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -9,7 +9,7 @@ import slimeknights.tconstruct.library.DryingRecipe;
|
|||
import slimeknights.tconstruct.library.TinkerRegistry;
|
||||
import slimeknights.tconstruct.library.modifiers.IModifier;
|
||||
import slimeknights.tconstruct.library.smeltery.AlloyRecipe;
|
||||
import slimeknights.tconstruct.library.smeltery.CastingRecipe;
|
||||
import slimeknights.tconstruct.library.smeltery.ICastingRecipe;
|
||||
import slimeknights.tconstruct.library.smeltery.MeltingRecipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -18,8 +18,8 @@ import java.util.Map;
|
|||
|
||||
public class TConstructHelper {
|
||||
public static List<AlloyRecipe> alloys = null;
|
||||
public static List<CastingRecipe> basinCasting = null;
|
||||
public static List<CastingRecipe> tableCasting = null;
|
||||
public static List<ICastingRecipe> basinCasting = null;
|
||||
public static List<ICastingRecipe> tableCasting = null;
|
||||
public static List<MeltingRecipe> smeltingList = null;
|
||||
// public static Map<ItemMetaWrapper, Integer> temperatureList = null;
|
||||
public static List<FluidStack> fuelList = new ArrayList<FluidStack>();
|
||||
|
@ -28,13 +28,13 @@ public class TConstructHelper {
|
|||
|
||||
static {
|
||||
try {
|
||||
alloys = ReflectionHelper.getStaticObject(TinkerRegistry.class, "alloyRegistry");//TinkerRegistry.getAlloys();
|
||||
smeltingList = TinkerRegistry.getAllMeltingRecipies();
|
||||
basinCasting = TinkerRegistry.getAllBasinCastingRecipes();
|
||||
tableCasting = TinkerRegistry.getAllTableCastingRecipes();
|
||||
alloys = ReflectionHelper.getStaticObject(TinkerRegistry.class, "alloyRegistry");
|
||||
smeltingList = ReflectionHelper.getStaticObject(TinkerRegistry.class, "meltingRegistry");
|
||||
basinCasting = ReflectionHelper.getStaticObject(TinkerRegistry.class, "basinCastRegistry");
|
||||
tableCasting = ReflectionHelper.getStaticObject(TinkerRegistry.class, "tableCastRegistry");
|
||||
modifiers = ReflectionHelper.getStaticObject(TinkerRegistry.class, "modifiers");
|
||||
modifiers_clone = new THashMap<String, IModifier>(modifiers);
|
||||
fuelList.addAll(TinkerRegistry.getSmelteryFuels());
|
||||
fuelList = new ArrayList<>(TinkerRegistry.getSmelteryFuels());
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import slimeknights.tconstruct.library.DryingRecipe;
|
|||
import slimeknights.tconstruct.library.TinkerRegistry;
|
||||
import slimeknights.tconstruct.library.smeltery.AlloyRecipe;
|
||||
import slimeknights.tconstruct.library.smeltery.CastingRecipe;
|
||||
import slimeknights.tconstruct.library.smeltery.ICastingRecipe;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
|
@ -35,20 +36,20 @@ public class TConstructLogger implements ICommandFunction {
|
|||
}
|
||||
} else {
|
||||
if (args.isEmpty() || args.contains("Casting")) {
|
||||
for (CastingRecipe recipe : TConstructHelper.basinCasting) {
|
||||
for (ICastingRecipe recipe : TConstructHelper.basinCasting) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.tconstruct.Casting.addBasinRecipe(%s, %s, %s, %s, %d);",
|
||||
LogHelper.getStackDescription(recipe.getResult()),
|
||||
LogHelper.getStackDescription(recipe.getFluid()),
|
||||
LogHelper.getStackDescription(recipe.cast),
|
||||
LogHelper.getStackDescription(((CastingRecipe) recipe).getResult()),
|
||||
LogHelper.getStackDescription(((CastingRecipe) recipe).getFluid()),
|
||||
LogHelper.getStackDescription(((CastingRecipe) recipe).cast),
|
||||
recipe.consumesCast(),
|
||||
recipe.getTime()));
|
||||
}
|
||||
|
||||
for (CastingRecipe recipe : TConstructHelper.tableCasting) {
|
||||
for (ICastingRecipe recipe : TConstructHelper.tableCasting) {
|
||||
MineTweakerAPI.logCommand(String.format("mods.tconstruct.Casting.addTableRecipe(%s, %s, %s, %s, %d);",
|
||||
LogHelper.getStackDescription(recipe.getResult()),
|
||||
LogHelper.getStackDescription(recipe.getFluid()),
|
||||
LogHelper.getStackDescription(recipe.cast),
|
||||
LogHelper.getStackDescription(((CastingRecipe) recipe).getResult()),
|
||||
LogHelper.getStackDescription(((CastingRecipe) recipe).getFluid()),
|
||||
LogHelper.getStackDescription(((CastingRecipe) recipe).cast),
|
||||
recipe.consumesCast(),
|
||||
recipe.getTime()));
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import modtweaker.utils.BaseListAddition;
|
|||
import modtweaker.utils.BaseListRemoval;
|
||||
import slimeknights.mantle.util.RecipeMatch;
|
||||
import slimeknights.tconstruct.library.smeltery.CastingRecipe;
|
||||
import slimeknights.tconstruct.library.smeltery.ICastingRecipe;
|
||||
import stanhebben.zenscript.annotations.Optional;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
@ -35,7 +36,7 @@ public class Casting {
|
|||
return;
|
||||
}
|
||||
CastingRecipe rec = new CastingRecipe(toStack(output), RecipeMatch.of(toStack(cast)), toFluid(liquid).getFluid(), liquid.getAmount());
|
||||
MineTweakerAPI.apply(new Add(rec, (LinkedList<CastingRecipe>) TConstructHelper.basinCasting));
|
||||
MineTweakerAPI.apply(new Add(rec, (LinkedList<ICastingRecipe>) TConstructHelper.basinCasting));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
|
@ -49,19 +50,19 @@ public class Casting {
|
|||
match = RecipeMatch.of(toStack(cast));
|
||||
}
|
||||
CastingRecipe rec = new CastingRecipe(toStack(output), match, toFluid(liquid).getFluid(), liquid.getAmount());
|
||||
MineTweakerAPI.apply(new Add(rec, (LinkedList<CastingRecipe>) TConstructHelper.tableCasting));
|
||||
MineTweakerAPI.apply(new Add(rec, (LinkedList<ICastingRecipe>) TConstructHelper.tableCasting));
|
||||
}
|
||||
|
||||
//Passes the list to the base list implementation, and adds the recipe
|
||||
private static class Add extends BaseListAddition<CastingRecipe> {
|
||||
public Add(CastingRecipe recipe, LinkedList<CastingRecipe> list) {
|
||||
private static class Add extends BaseListAddition<ICastingRecipe> {
|
||||
public Add(CastingRecipe recipe, LinkedList<ICastingRecipe> list) {
|
||||
super(Casting.name, list);
|
||||
this.recipes.add(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(CastingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResult());
|
||||
protected String getRecipeInfo(ICastingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(((CastingRecipe) recipe).getResult());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +79,7 @@ public class Casting {
|
|||
removeRecipe(output, liquid, cast, TConstructHelper.basinCasting);
|
||||
}
|
||||
|
||||
public static void removeRecipe(IIngredient output, IIngredient liquid, IIngredient cast, List<CastingRecipe> list) {
|
||||
public static void removeRecipe(IIngredient output, IIngredient liquid, IIngredient cast, List<ICastingRecipe> list) {
|
||||
if (output == null) {
|
||||
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));
|
||||
return;
|
||||
|
@ -88,24 +89,24 @@ public class Casting {
|
|||
liquid = IngredientAny.INSTANCE;
|
||||
}
|
||||
|
||||
List<CastingRecipe> recipes = new LinkedList<CastingRecipe>();
|
||||
List<ICastingRecipe> recipes = new LinkedList<ICastingRecipe>();
|
||||
|
||||
for (CastingRecipe recipe : list) {
|
||||
for (ICastingRecipe recipe : list) {
|
||||
if (recipe != null) {
|
||||
if (!matches(output, toIItemStack(recipe.getResult()))) {
|
||||
if (!matches(output, toIItemStack(((CastingRecipe) recipe).getResult()))) {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!matches(liquid, toILiquidStack(recipe.getFluid()))) {
|
||||
if (!matches(liquid, toILiquidStack(((CastingRecipe) recipe).getFluid()))) {
|
||||
|
||||
continue;
|
||||
}
|
||||
if ((recipe.cast != null && cast != null) && (recipe.cast.matches(toStacks(cast.getItems().toArray(new IItemStack[0]))) == null)) {
|
||||
if ((((CastingRecipe) recipe).cast != null && cast != null) && (((CastingRecipe) recipe).cast.matches(toStacks(cast.getItems().toArray(new IItemStack[0]))) == null)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
recipes.add(recipe);
|
||||
recipes.add((CastingRecipe) recipe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,14 +122,15 @@ public class Casting {
|
|||
}
|
||||
|
||||
// Removes all matching recipes, apply is never the same for anything, so will always need to override it
|
||||
private static class Remove extends BaseListRemoval<CastingRecipe> {
|
||||
public Remove(List<CastingRecipe> list, List<CastingRecipe> recipes) {
|
||||
private static class Remove extends BaseListRemoval<ICastingRecipe> {
|
||||
public Remove(List<ICastingRecipe> list, List<ICastingRecipe> recipes) {
|
||||
super(Casting.name, list, recipes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(CastingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResult());
|
||||
protected String getRecipeInfo(ICastingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(((CastingRecipe) recipe).getResult());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,40 +2,32 @@ package modtweaker.utils;
|
|||
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class TweakerPlugin {
|
||||
private static Map<String, Boolean> mods = new TreeMap<String, Boolean>();
|
||||
private static List<String> mods = new LinkedList<String>();
|
||||
|
||||
public static void register(String mod, Boolean enabled, Class<?> clazz) {
|
||||
public static void register(String mod, Class<?> clazz) {
|
||||
if (Loader.isModLoaded(mod)) {
|
||||
load(mod, enabled, clazz);
|
||||
load(mod, clazz);
|
||||
}
|
||||
}
|
||||
|
||||
public static void load(String mod, boolean enabled, Class<?> clazz) {
|
||||
public static void load(String mod, Class<?> clazz) {
|
||||
try {
|
||||
clazz.newInstance();
|
||||
mods.put(mod, enabled);
|
||||
mods.add(mod);
|
||||
} catch (Exception e) {
|
||||
mods.remove(mod);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLoaded(String string) {
|
||||
return mods.containsKey(string);
|
||||
return mods.contains(string);
|
||||
}
|
||||
|
||||
public void setState(String mod, boolean state) {
|
||||
mods.put(mod, state);
|
||||
}
|
||||
|
||||
public boolean getState(String mod) {
|
||||
return mods.get(mod);
|
||||
}
|
||||
|
||||
public static Map<String, Boolean> getMods() {
|
||||
public static List<String> getMods() {
|
||||
return mods;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue