mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-22 21:29:47 +00:00
Also changes like all packages inb4 "jared changes a package name in ModTweaker2 breaking compatability with everything" drama tweet.
This commit is contained in:
1 parent
4fd2551072
commit
ec562b62ea
187 files changed
+977
-991
No files matched your search
@@ -0,0 +1,113 @@
|
||||
package modtweaker2.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user