Also changes like all packages inb4 "jared changes a package name in ModTweaker2 breaking compatability with everything" drama tweet.
49 lines
1 KiB
Java
49 lines
1 KiB
Java
package modtweaker2.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;
|
|
}
|
|
}
|