本文整理匯總了Java中net.minecraftforge.common.config.ConfigCategory類的典型用法代碼示例。如果您正苦於以下問題:Java ConfigCategory類的具體用法?Java ConfigCategory怎麽用?Java ConfigCategory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ConfigCategory類屬於net.minecraftforge.common.config包,在下文中一共展示了ConfigCategory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getConfigElements
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
@SuppressWarnings({ "rawtypes" })
private static @Nonnull List<IConfigElement> getConfigElements() {
final List<IConfigElement> list = new ArrayList<IConfigElement>();
for (final String cat : Config.getConfig().getCategoryNames()) {
final ConfigCategory cc = Config.getConfig().getCategory(cat);
if (cc.isChild())
continue;
final ConfigElement ce = new ConfigElement<String>(cc);
list.add(ce);
}
return list;
}
示例2: setupBookConfig
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
public static void setupBookConfig(Configuration cfg) {
ConfigCategory category = cfg.getCategory(CATEGORY_BOOKS);
if (category.isEmpty()) {
// Initialize with defaults
addBook(cfg, Items.BOOK.getRegistryName().toString(), "*");
addBook(cfg, Items.ENCHANTED_BOOK.getRegistryName().toString(), "*");
addBook(cfg, Items.WRITABLE_BOOK.getRegistryName().toString(), "*");
addBook(cfg, Items.WRITTEN_BOOK.getRegistryName().toString(), "*");
addBook(cfg, "rftools:rftools_manual", BookType.BOOK_BLUE.getModel());
addBook(cfg, "rftoolscontrol:rftoolscontrol_manual", BookType.BOOK_GREEN.getModel());
addBook(cfg, "rftoolsdim:rftoolsdim_manual", BookType.BOOK_GREEN.getModel());
addBook(cfg, "deepresonance:dr_manual", BookType.BOOK_RED.getModel());
} else {
for (Map.Entry<String, Property> entry : category.entrySet()) {
validBooks.put(entry.getKey(), entry.getValue().getString());
}
}
}
示例3: buildChildScreen
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
/**
* This method is called in the constructor and is used to set the childScreen field.
*/
@Override
protected GuiScreen buildChildScreen()
{
List<IConfigElement> list = new ArrayList<IConfigElement>();
list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig",
AddModOverrideEntry.class));
for (ConfigCategory cc : ForgeChunkManager.getModCategories())
list.add(new ConfigElement(cc));
return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title,
I18n.format("forge.configgui.ctgy.forgeChunkLoadingModConfig"));
}
示例4: JsonConfig
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
public JsonConfig(File file){
this.keybindingFile = new File(file.getParent()+"/macrokey/keybindings.json");
this.layerFile = new File(file.getParent()+"/macrokey/layers.json");
MacroKey.instance.boundKeys = new ArrayList<BoundKey>();
MacroKey.instance.layers = new ArrayList<Layer>();
File dir = new File(file.getParent()+"/macrokey/");
if(!dir.exists()){
dir.mkdir();
}
FileHelper.fileExist(keybindingFile);
FileHelper.fileExist(layerFile);
ConfigCategory category = MacroKey.instance.configuration.getCategory("bindings");
if(!category.isEmpty()){
LogHelper.info("Old Configuration File Detected! Converting...");
convertConfig();
MacroKey.instance.configuration.removeCategory(category);
MacroKey.instance.configuration.save();
}
}
示例5: buildChildScreen
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
/**
* This method is called in the constructor and is used to set the childScreen field.
*/
@Override
protected GuiScreen buildChildScreen()
{
List<IConfigElement> list = new ArrayList<IConfigElement>();
list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig",
AddModOverrideEntry.class));
for (ConfigCategory cc : ForgeChunkManager.getModCategories())
list.add(new ConfigElement(cc));
return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title,
I18n.func_135052_a("forge.configgui.ctgy.forgeChunkLoadingModConfig"));
}
示例6: getConfigElements
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
@SuppressWarnings("rawtypes")
private static @Nonnull List<IConfigElement> getConfigElements() {
final List<IConfigElement> list = new ArrayList<IConfigElement>();
for (final String cat : Config.getConfig().getCategoryNames()) {
final ConfigCategory cc = Config.getConfig().getCategory(cat);
if (cc.isChild())
continue;
final ConfigElement ce = new ConfigElement<String>(cc);
list.add(ce);
}
return list;
}
示例7: getConfigElements
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
private static List<IConfigElement> getConfigElements()
{
List<IConfigElement> elements = new ArrayList<IConfigElement>();
for (String name : Blockbuster.proxy.forge.getCategoryNames())
{
ConfigCategory category = Blockbuster.proxy.forge.getCategory(name);
category.setLanguageKey("blockbuster.config." + name + ".title");
if (name.indexOf(".") == -1)
{
elements.add(new ConfigElement(category));
}
}
return elements;
}
示例8: parse
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
@Override
public BooleanSupplier parse(JsonContext context, JsonObject json) {
String category = JsonUtils.getString(json, "category");
String key = JsonUtils.getString(json, "key");
boolean flip = JsonUtils.getBoolean(json, "flip", false);
if (config.hasCategory(category)) {
ConfigCategory cat = config.getCategory(category);
if (cat.containsKey(key) && cat.get(key).isBooleanValue()) {
return () -> flip != cat.get(key).getBoolean();
} else {
throw new JsonParseException(String.format("Key doesn't exist on category or is not of a boolean type. Category: %s, Key: %s", category, key));
}
} else {
throw new JsonParseException(String.format("Category doesn't exist on config file. Category: %s, Config: %s", category, config.getConfigFile().getAbsolutePath()));
}
}
示例9: getConfigElements
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
@SuppressWarnings("rawtypes")
private static List<IConfigElement> getConfigElements() {
final List<IConfigElement> list = new ArrayList<IConfigElement>();
for (final String cat : ConfigHandler.instance.getCategoryNames()) {
final ConfigCategory cc = ConfigHandler.instance.getCategory(cat);
if (cc.isChild())
continue;
final ConfigElement ce = new ConfigElement<String>(cc);
list.add(ce);
}
return list;
}
示例10: parse
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
@Override
public BooleanSupplier parse(JsonContext context, JsonObject json)
{
JsonPrimitive categoryName = json.getAsJsonPrimitive("category");
JsonPrimitive keyName = json.getAsJsonPrimitive("key");
ConfigCategory category = ConfigManager.instance.config.getCategory(categoryName.getAsString());
Property property = category != null ? category.get(keyName.getAsString()) : null;
if (property == null)
{
Survivalist.logger.error("Property not found! {} / {}", categoryName.getAsString(), keyName.getAsString());
return () -> false;
}
return property::getBoolean;
}
示例11: isFree
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
boolean isFree(String name, int val) {
for (String categoryName : channelConfig.getCategoryNames()) {
ConfigCategory cat = channelConfig.getCategory(categoryName);
if (cat.getQualifiedName().equals(name)) {
if (channelConfig.get(categoryName, "channel", val).getInt() == val) {
return true;
}
// Uhm.
continue;
}
if (!cat.containsKey("channel")) {
continue;
}
int here_chan = channelConfig.get(categoryName, "channel", -1).getInt();
if (here_chan == val) {
return false;
}
}
return true;
}
示例12: initGrindstoneRecipes
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
public static void initGrindstoneRecipes(Configuration cfg) {
ConfigCategory category = cfg.getCategory(CATEGORY_RECIPES_GRINDSTONE);
if (category.isEmpty()) {
// Initialize with defaults
addRecipe(cfg, "flour", new ItemStack(Items.WHEAT), new ItemStack(ModItems.flour), 100);
addRecipe(cfg, "bonemeal", new ItemStack(Items.BONE), new ItemStack(Items.DYE, 5, EnumDyeColor.WHITE.getDyeDamage()), 100);
addRecipe(cfg, "flint", new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT, 2), 100);
addRecipe(cfg, "glowstone", new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), 300);
addRecipe(cfg, "sugar", new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 2), 100);
addRecipe(cfg, "blazepowder", new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 3), 200);
} else {
for (Map.Entry<String, Property> entry : category.entrySet()) {
String[] list = entry.getValue().getStringList();
GrindstoneRecipeRepository.addRecipe(new GrindstoneRecipe(getItem(list, 0), getItem(list, 1), getInt(list, 2)));
}
}
}
示例13: initConfig
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
@Override
public void initConfig(Configuration cfg) {
super.initConfig(cfg);
maxHardness = (float) cfg.get(Config.CATEGORY_WANDS, getUnlocalizedName() + "_maxHardness", maxHardness, "Max hardness this block can move.)").getDouble();
placeDistance = cfg.get(Config.CATEGORY_WANDS, getUnlocalizedName() + "_placeDistance", placeDistance, "Distance at which to place blocks in 'in-air' mode").getInt();
ConfigCategory category = cfg.getCategory(Config.CATEGORY_MOVINGBLACKLIST);
if (category.isEmpty()) {
// Initialize with defaults
blacklist(cfg, "tile.shieldBlock");
blacklist(cfg, "tile.shieldBlock2");
blacklist(cfg, "tile.shieldBlock3");
blacklist(cfg, "tile.solidShieldBlock");
blacklist(cfg, "tile.invisibleShieldBlock");
setCost(cfg, "tile.mobSpawner", 5.0);
setCost(cfg, "tile.blockAiry", 20.0);
} else {
for (Map.Entry<String, Property> entry : category.entrySet()) {
blacklisted.put(entry.getKey(), entry.getValue().getDouble());
}
}
}
示例14: villageConfiguration
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
public static void villageConfiguration() {
ConfigCategory cat_village = config.getCategory(CATEGORY_VILLAGE);
cat_village.setComment("Here you can configure the village generation");
loadFields(cat_village, VILLAGE.class);
if (VILLAGE.village_minDist < 0) {
LogHelper.error("VillageDensity: Invalid config: Minimal distance must be non-negative.");
VILLAGE.village_gen_enabled = false;
}
if (VILLAGE.village_minDist >= VILLAGE.village_density) {
LogHelper.error("VillageDensity: Invalid config: Minimal distance must be smaller than density.");
VILLAGE.village_gen_enabled = false;
}
if (VILLAGE.village_size < 0) {
VILLAGE.village_gen_enabled = false;
LogHelper.error("VillageDensity: Invalid config: Size must be non-negative.");
}
}
示例15: getChestGenerationHooks
import net.minecraftforge.common.config.ConfigCategory; //導入依賴的package包/類
private static List<ChestGenHooks> getChestGenerationHooks() {
if (chestHooks != null)
return chestHooks;
chestHooks = new ArrayList<ChestGenHooks>();
final ConfigCategory c = chests.getCategory(ConfigProcessor.CONFIG_CHESTS);
for (final ConfigCategory p : c.getChildren()) {
if(!isContainerNode(p)) {
processEntry(null, p, chestHooks);
} else {
for (final ConfigCategory cc : p.getChildren())
processEntry(p, cc, chestHooks);
}
}
return chestHooks;
}