ModTweaker/src/main/java/modtweaker2/mods/botania/lexicon/SetCategoryPriority.java
jaredlll08 ec562b62ea This closes #17 and closes #58, I tested and it worked using the script given
Also changes like all packages
inb4 "jared changes a package name in ModTweaker2 breaking compatability
with everything" drama tweet.
2015-02-20 23:57:32 +02:00

48 lines
1,021 B
Java

package modtweaker2.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;
}
}