Here are the examples of the java api codechicken.lib.config.ConfigTagParent taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
18
Source : JEIIntegrationManager.java
with MIT License
from TheCBProject
with MIT License
from TheCBProject
public static void initConfig(ConfigTagParent tag) {
sereplacedemPanelOwner(tag.getTag("jei.itemPanel").getIntValue(1));
setSearchBoxOwner(tag.getTag("jei.searchBox").getIntValue(1));
}
18
Source : ConfigSet.java
with MIT License
from TheCBProject
with MIT License
from TheCBProject
public clreplaced ConfigSet {
private File nbtFile;
public NBTTagCompound nbt;
public ConfigTagParent config;
public ConfigSet(File nbtFile, ConfigTagParent config) {
this.nbtFile = nbtFile;
this.config = config;
loadNBT();
}
public void loadNBT() {
nbt = new NBTTagCompound();
try {
if (!nbtFile.getParentFile().exists()) {
nbtFile.getParentFile().mkdirs();
}
if (!nbtFile.exists()) {
nbtFile.createNewFile();
}
if (nbtFile.length() > 0) {
nbt = NEIServerUtils.readNBT(nbtFile);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void saveNBT() {
try {
NEIServerUtils.writeNBT(nbt, nbtFile);
} catch (Exception e) {
e.printStackTrace();
}
}
}
16
Source : NEIClientConfig.java
with MIT License
from TheCBProject
with MIT License
from TheCBProject
private static void setDefaults() {
ConfigTagParent tag = global.config;
tag.setComment("Main configuration of NEI.\nMost of these options can be changed ingame.\nDeleting any element will restore it to it's default value");
tag.getTag("command").useBraces().setComment("Change these options if you have a different mod installed on the server that handles the commands differently, Eg. Bukkit Essentials");
tag.setNewLineMode(1);
tag.getTag("inventory.widgetsenabled").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.widgetsenabled"));
tag.getTag("inventory.hidden").getBooleanValue(false);
tag.getTag("inventory.cheatmode").getIntValue(2);
tag.getTag("inventory.lockmode").setComment("For those who can't help themselves.\nSet this to a mode and you will be unable to change it ingame").getIntValue(-1);
API.addOption(new OptionCycled("inventory.cheatmode", 3) {
@Override
public boolean optionValid(int index) {
return getLockedMode() == -1 || getLockedMode() == index;
}
});
checkCheatMode();
tag.getTag("inventory.utilities").setDefaultValue("delete, magnet");
API.addOption(new OptionUtilities("inventory.utilities"));
tag.getTag("inventory.gamemodes").setDefaultValue("creative, creative+, adventure");
API.addOption(new OptionGamemodes("inventory.gamemodes"));
tag.getTag("inventory.layoutstyle").getIntValue(0);
API.addOption(new OptionCycled("inventory.layoutstyle", 0) {
@Override
public String getPrefix() {
return translateN(name);
}
@Override
public String getButtonText() {
return NEIClientUtils.translate("layoutstyle." + LayoutManager.getLayoutStyle(renderTag().getIntValue()).getName());
}
@Override
public boolean cycle() {
LinkedList<Integer> list = new LinkedList<>();
for (Entry<Integer, LayoutStyle> entry : LayoutManager.layoutStyles.entrySet()) {
list.add(entry.getKey());
}
Collections.sort(list);
int nextLayout = renderTag().getIntValue();
if (// loop list
nextLayout == list.getLast()) {
nextLayout = -1;
}
for (Integer i : list) {
if (i > nextLayout) {
nextLayout = i;
break;
}
}
getTag().setIntValue(nextLayout);
return true;
}
});
ItemSorter.initConfig(tag);
tag.getTag("inventory.itemIDs").getIntValue(1);
API.addOption(new OptionCycled("inventory.itemIDs", 3, true));
tag.getTag("inventory.searchmode").getIntValue(1);
API.addOption(new OptionCycled("inventory.searchmode", 3, true));
tag.getTag("inventory.profileRecipes").getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.profileRecipes", true));
tag.getTag("inventory.disableMouseScrollTransfer").getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.disableMouseScrollTransfer", true));
tag.getTag("inventory.invertMouseScrollTransfer").getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.invertMouseScrollTransfer", true) {
@Override
public boolean isEnabled() {
return isMouseScrollTransferEnabled();
}
});
tag.getTag("command.creative").setDefaultValue("/gamemode {0} {1}");
API.addOption(new OptionTextField("command.creative"));
tag.getTag("command.item").setDefaultValue("/give {0} {1} {2} {3} {4}");
API.addOption(new OptionTextField("command.item"));
tag.getTag("command.time").setDefaultValue("/time set {0}");
API.addOption(new OptionTextField("command.time"));
tag.getTag("command.rain").setDefaultValue("/toggledownfall");
API.addOption(new OptionTextField("command.rain"));
tag.getTag("command.heal").setDefaultValue("");
API.addOption(new OptionTextField("command.heal"));
JEIIntegrationManager.initConfig(tag);
API.addOption(new ItemBrowserButton("jei.itemPanel") {
@Override
protected void setValue(EnumItemBrowser itemBrowser) {
JEIIntegrationManager.sereplacedemPanelOwner(itemBrowser);
}
});
API.addOption(new ItemBrowserButton("jei.searchBox") {
@Override
public boolean isEnabled() {
return JEIIntegrationManager.itemPanelOwner == EnumItemBrowser.JEI;
}
@Override
protected void setValue(EnumItemBrowser itemBrowser) {
JEIIntegrationManager.setSearchBoxOwner(itemBrowser);
}
});
}
14
Source : ItemSorter.java
with MIT License
from TheCBProject
with MIT License
from TheCBProject
public static void initConfig(ConfigTagParent tag) {
// minecraft, mod, id, default, meta, name
API.addSortOption("nei.itemsort.minecraft", (o1, o2) -> {
boolean m1 = "minecraft".equals(ItemInfo.itemOwners.get(o1.gereplacedem()));
boolean m2 = "minecraft".equals(ItemInfo.itemOwners.get(o2.gereplacedem()));
return m1 == m2 ? 0 : m1 ? -1 : 1;
});
API.addSortOption("nei.itemsort.mod", (o1, o2) -> {
String mod1 = ItemInfo.itemOwners.get(o1.gereplacedem());
String mod2 = ItemInfo.itemOwners.get(o2.gereplacedem());
if (mod1 == null) {
return mod2 == null ? 0 : 1;
}
if (mod2 == null) {
return -1;
}
return mod1.compareTo(mod2);
});
API.addSortOption("nei.itemsort.id", (o1, o2) -> {
int id1 = Item.getIdFromItem(o1.gereplacedem());
int id2 = Item.getIdFromItem(o2.gereplacedem());
return compareInt(id1, id2);
});
API.addSortOption("nei.itemsort.default", (o1, o2) -> {
Integer order1 = instance.ordering.get(o1);
Integer order2 = instance.ordering.get(o2);
if (order1 == null) {
return order2 == null ? 0 : 1;
}
if (order2 == null) {
return -1;
}
return compareInt(order1, order2);
});
API.addSortOption("nei.itemsort.damage", (o1, o2) -> {
int id1 = o1.gereplacedemDamage();
int id2 = o2.gereplacedemDamage();
return compareInt(id1, id2);
});
API.addSortOption("nei.itemsort.name", (o1, o2) -> {
String name1 = ItemInfo.getSearchName(o1);
String name2 = ItemInfo.getSearchName(o2);
return name1.compareTo(name2);
});
tag.getTag("inventory.itemsort").setDefaultValue(getSaveString(list));
API.addOption(new OptionOpenGui("inventory.itemsort", GuiItemSorter.clreplaced) {
@Override
public void useGlobals() {
super.useGlobals();
list = fromSaveString(activeTag().getValue());
}
});
ItemList.registerLoadCallback(instance);
}