commit
d4ec0134cf
|
@ -4,6 +4,9 @@ import minetweaker.MineTweakerAPI;
|
|||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.mods.botania.Botania;
|
||||
import modtweaker.mods.botania.lexicon.commands.LexiconCategoryLogger;
|
||||
import modtweaker.mods.botania.lexicon.commands.LexiconEntryLogger;
|
||||
import modtweaker.mods.botania.lexicon.commands.LexiconPageLogger;
|
||||
import modtweaker.mods.exnihilo.ExNihilo;
|
||||
import modtweaker.mods.extendedworkbench.ExtendedWorkbench;
|
||||
import modtweaker.mods.factorization.Factorization;
|
||||
|
@ -79,5 +82,12 @@ public class ModTweaker {
|
|||
if (TweakerPlugin.isLoaded("TConstruct")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("materials", new String[] { "/minetweaker materials", " Outputs a list of all Tinker's Construct material names in the game to the minetweaker log" }, new MaterialLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("Botania")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("lexiconCategories", new String[] { "/minetweaker lexiconCategories", " Outputs a list of lexicon categories" }, new LexiconCategoryLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("lexiconEntries", new String[] { "/minetweaker lexiconEntries", "/minetweaker lexiconEntries [CATEGORY]", " Outputs a list of lexicon entries" }, new LexiconEntryLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("lexiconPages", new String[] { "/minetweaker lexiconPages", "/minetweaker lexiconPages [ENTRY]", " Outputs a list of lexicon pages for the entry" }, new LexiconPageLogger());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package modtweaker.mods.botania;
|
|||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.botania.handlers.Apothecary;
|
||||
import modtweaker.mods.botania.handlers.ElvenTrade;
|
||||
import modtweaker.mods.botania.handlers.Lexicon;
|
||||
import modtweaker.mods.botania.handlers.ManaInfusion;
|
||||
import modtweaker.mods.botania.handlers.Orechid;
|
||||
import modtweaker.mods.botania.handlers.RuneAltar;
|
||||
|
@ -16,6 +17,7 @@ public class Botania {
|
|||
MineTweakerAPI.registerClass(ManaInfusion.class);
|
||||
MineTweakerAPI.registerClass(Orechid.class);
|
||||
MineTweakerAPI.registerClass(RuneAltar.class);
|
||||
MineTweakerAPI.registerClass(Lexicon.class);
|
||||
}
|
||||
|
||||
public static boolean isSubtile(ItemStack stack) {
|
||||
|
|
41
src/main/java/modtweaker/mods/botania/BotaniaHelper.java
Normal file
41
src/main/java/modtweaker/mods/botania/BotaniaHelper.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
package modtweaker.mods.botania;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
244
src/main/java/modtweaker/mods/botania/handlers/Lexicon.java
Normal file
244
src/main/java/modtweaker/mods/botania/handlers/Lexicon.java
Normal file
|
@ -0,0 +1,244 @@
|
|||
package modtweaker.mods.botania.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.toObject;
|
||||
import static modtweaker.helpers.InputHelper.toObjects;
|
||||
import static modtweaker.helpers.InputHelper.toShapedObjects;
|
||||
import static modtweaker.helpers.InputHelper.toStack;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.recipes.ShapedRecipe;
|
||||
import minetweaker.mc1710.recipes.RecipeConverter;
|
||||
import modtweaker.mods.botania.BotaniaHelper;
|
||||
import modtweaker.mods.botania.lexicon.AddCategory;
|
||||
import modtweaker.mods.botania.lexicon.AddEntry;
|
||||
import modtweaker.mods.botania.lexicon.AddPage;
|
||||
import modtweaker.mods.botania.lexicon.RemoveCategory;
|
||||
import modtweaker.mods.botania.lexicon.RemoveEntry;
|
||||
import modtweaker.mods.botania.lexicon.RemovePage;
|
||||
import modtweaker.mods.botania.lexicon.SetCategoryIcon;
|
||||
import modtweaker.mods.botania.lexicon.SetCategoryPriority;
|
||||
import modtweaker.mods.botania.lexicon.SetEntryKnowledgeType;
|
||||
import modtweaker.util.BaseListAddition;
|
||||
import modtweaker.util.BaseListRemoval;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.common.lexicon.page.PageBrew;
|
||||
import vazkii.botania.common.lexicon.page.PageCraftingRecipe;
|
||||
import vazkii.botania.common.lexicon.page.PageElvenRecipe;
|
||||
import vazkii.botania.common.lexicon.page.PageEntity;
|
||||
import vazkii.botania.common.lexicon.page.PageImage;
|
||||
import vazkii.botania.common.lexicon.page.PageLoreText;
|
||||
import vazkii.botania.common.lexicon.page.PageManaInfusionRecipe;
|
||||
import vazkii.botania.common.lexicon.page.PagePetalRecipe;
|
||||
import vazkii.botania.common.lexicon.page.PageRuneRecipe;
|
||||
import vazkii.botania.common.lexicon.page.PageText;
|
||||
|
||||
@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);
|
||||
RecipeBrew page_recipe=new RecipeBrew(BotaniaAPI.getBrewFromKey(brew),(Object[])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(outputs.length!=inputs.length)
|
||||
throw new IllegalArgumentException("Length of input and output must match");
|
||||
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(outputs.length!=inputs.length)
|
||||
throw new IllegalArgumentException("Length of input and output must match");
|
||||
List<RecipeElvenTrade> recipes=new ArrayList<RecipeElvenTrade>();
|
||||
for(int i=0;i<outputs.length;i++)
|
||||
{
|
||||
recipes.add(new RecipeElvenTrade(toStack(outputs[i]),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);
|
||||
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);
|
||||
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);
|
||||
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(outputs.length!=inputs.length || outputs.length!=mana.length)
|
||||
throw new IllegalArgumentException("Length of input and output must match");
|
||||
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(outputs.length!=inputs.length || outputs.length!=mana.length)
|
||||
throw new IllegalArgumentException("Length of input and output must match");
|
||||
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(outputs.length!=inputs.length || outputs.length!=mana.length)
|
||||
throw new IllegalArgumentException("Length of input and output must match");
|
||||
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(outputs.length!=inputs.length)
|
||||
throw new IllegalArgumentException("Length of input and output must match");
|
||||
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(outputs.length!=inputs.length || outputs.length!=mana.length)
|
||||
throw new IllegalArgumentException("Length of input and output must match");
|
||||
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);
|
||||
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);
|
||||
MineTweakerAPI.apply(new RemovePage(lexiconEntry,page_number));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addEntry(String entry, String catagory) {
|
||||
LexiconCategory lexiconCatagory=BotaniaHelper.findCatagory(catagory);
|
||||
LexiconEntry lexiconEntry=new LexiconEntry(entry,lexiconCatagory);
|
||||
MineTweakerAPI.apply(new AddEntry(lexiconEntry));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeEntry(String entry) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
MineTweakerAPI.apply(new RemoveEntry(lexiconEntry));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void setEntryKnowledgeType(String entry, String knowledgeType) {
|
||||
LexiconEntry lexiconEntry=BotaniaHelper.findEntry(entry);
|
||||
KnowledgeType type=BotaniaHelper.findKnowledgeType(knowledgeType);
|
||||
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 lexiconCatagory=BotaniaHelper.findCatagory(name);
|
||||
MineTweakerAPI.apply(new RemoveCategory(lexiconCatagory));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void setCategoryPriority(String name, int priority) {
|
||||
LexiconCategory lexiconCatagory=BotaniaHelper.findCatagory(name);
|
||||
MineTweakerAPI.apply(new SetCategoryPriority(lexiconCatagory,priority));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void setCategoryIcon(String name, String icon) {
|
||||
LexiconCategory lexiconCatagory=BotaniaHelper.findCatagory(name);
|
||||
MineTweakerAPI.apply(new SetCategoryIcon(lexiconCatagory,icon));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
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 vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
52
src/main/java/modtweaker/mods/botania/lexicon/AddPage.java
Normal file
52
src/main/java/modtweaker/mods/botania/lexicon/AddPage.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
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() {
|
||||
if(Entry==null)
|
||||
throw new NullPointerException("Entry not found");
|
||||
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,46 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
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 vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
public class RemoveEntry implements IUndoableAction {
|
||||
|
||||
LexiconEntry Entry;
|
||||
|
||||
public RemoveEntry(LexiconEntry Entry) {
|
||||
this.Entry=Entry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
Entry.category.entries.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,50 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
public class RemovePage implements IUndoableAction {
|
||||
|
||||
String Name;
|
||||
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);
|
||||
this.Name=this.page.getUnlocalizedName();
|
||||
Entry.pages.remove(page_number);
|
||||
}
|
||||
|
||||
@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.add(page_number,page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
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,50 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
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,50 @@
|
|||
package modtweaker.mods.botania.lexicon;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
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,28 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
|
||||
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,36 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.mods.botania.BotaniaHelper;
|
||||
|
||||
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]);
|
||||
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,34 @@
|
|||
package modtweaker.mods.botania.lexicon.commands;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.mods.botania.BotaniaHelper;
|
||||
|
||||
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]);
|
||||
List<LexiconPage> pages=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"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue