本文整理了Java中net.minecraftforge.common.config.Configuration.get()
方法的一些代码示例,展示了Configuration.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.get()
方法的具体详情如下:
包路径:net.minecraftforge.common.config.Configuration
类名称:Configuration
方法名:get
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public long nextGridStorage()
{
final long r = this.lastGridStorage;
this.lastGridStorage++;
this.config.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) );
return r;
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
prop = configFile.get(cat, "spawnWithBook", spawnWithBook);
prop.setComment("Players who enter the world for the first time get a Tinkers' Book");
spawnWithBook = prop.getBoolean();
propOrder.add(prop.getName());
prop = configFile.get(cat, "reuseStencils", reuseStencil);
prop.setComment("Allows to reuse stencils in the stencil table to turn them into other stencils");
reuseStencil = prop.getBoolean();
propOrder.add(prop.getName());
prop = configFile.get(cat, "chestsKeepInventory", chestsKeepInventory);
prop.setComment("Pattern and Part chests keep their inventory when harvested.");
chestsKeepInventory = prop.getBoolean();
propOrder.add(prop.getName());
prop = configFile.get(cat, "enableClayCasts", claycasts);
prop.setComment("Adds single-use clay casts.");
claycasts = prop.getBoolean();
prop = configFile.get(cat, "allowBrickCasting", castableBricks);
prop.setComment("Allows the creation of bricks from molten clay");
castableBricks = prop.getBoolean();
prop = configFile.get(cat, "AutosmeltFortuneInteraction", autosmeltlapis);
prop.setComment("Fortune increases drops after harvesting a block with autosmelt");
autosmeltlapis = prop.getBoolean();
propOrder.add(prop.getName());
prop = configFile.get(cat, "craftCastableMaterials", craftCastableMaterials);
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
private int nextPlayer()
{
final int r = this.lastPlayerID;
this.lastPlayerID++;
this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, this.lastPlayerID ).set( this.lastPlayerID );
return r;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
.get( CONFIG_COMMON_KEY, CONFIG_COMMON_ALLOW_TILEENTITIES_KEY, false, CONFIG_COMMON_ALLOW_TILEENTITIES_COMMENT )
.setRequiresMcRestart( true )
.setShowInGui( false )
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public Property get( final String category, final String key, final String defaultValue, final String comment, final Property.Type type )
{
final Property prop = super.get( category, key, defaultValue, comment, type );
if( prop != null )
{
if( !category.equals( "Client" ) )
{
prop.setRequiresMcRestart( true );
}
}
return prop;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
/**
* Stores the current date in milli seconds into the "lastCheck" field of the config and makes it persistent.
*/
public void updateLastCheck()
{
final Date now = new Date();
final long nowInMs = now.getTime();
final String nowAsString = Long.toString( nowInMs );
this.config.get( "cache", "lastCheck", "0" ).set( nowAsString );
this.config.save();
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public void setCache( @Nonnull final String digest )
{
final Property digestProperty = this.config.get( CACHE_CATEGORY, DIGEST_KEY, DIGEST_DEFAULT );
digestProperty.set( digest );
this.config.save();
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public void onWorldStart()
{
final String lastString = this.config.get( LAST_GRID_STORAGE_CATEGORY, LAST_GRID_STORAGE_KEY, LAST_GRID_STORAGE_DEFAULT ).getString();
try
{
this.lastGridStorage = Long.parseLong( lastString );
}
catch( final NumberFormatException err )
{
AELog.warn( "The config contained a value which was not represented as a Long: %s", lastString );
this.lastGridStorage = 0;
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public void onWorldStart()
{
this.lastPlayerID = this.config.get( LAST_PLAYER_CATEGORY, LAST_PLAYER_KEY, LAST_PLAYER_DEFAULT ).getInt( LAST_PLAYER_DEFAULT );
this.config.save();
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public int getNextOrderedValue( final String name )
{
final Property p = this.config.get( "orderedValues", name, 0 );
final int myValue = p.getInt();
p.set( myValue + 1 );
return myValue;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
/**
* lazy loading, can load any id, even ones that don't exist anymore.
*
* @param storageID ID of grid storage
*
* @return corresponding grid storage
*/
@Nullable
@Override
public GridStorage getGridStorage( final long storageID )
{
final GridStorageSearch gss = new GridStorageSearch( storageID );
final WeakReference<GridStorageSearch> result = this.loadedStorage.get( gss );
if( result == null || result.get() == null )
{
final String id = String.valueOf( storageID );
final String data = this.config.get( "gridstorage", id, "" ).getString();
final GridStorage thisStorage = new GridStorage( data, storageID, gss );
gss.setGridStorage( new WeakReference<>( thisStorage ) );
this.loadedStorage.put( gss, new WeakReference<>( gss ) );
return thisStorage;
}
return result.get().getGridStorage().get();
}
代码示例来源:origin: Vazkii/Botania
public static double loadPropDouble(String propName, String desc, double default_) {
Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_);
prop.setComment(desc);
if(adaptor != null)
adaptor.adaptPropertyDouble(prop, prop.getDouble(default_));
return prop.getDouble(default_);
}
代码示例来源:origin: Vazkii/Botania
public static int loadPropInt(String propName, String desc, int default_) {
Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_);
prop.setComment(desc);
if(adaptor != null)
adaptor.adaptPropertyInt(prop, prop.getInt(default_));
return prop.getInt(default_);
}
代码示例来源:origin: Vazkii/Botania
public static boolean loadPropBool(String propName, String desc, boolean default_) {
Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_);
prop.setComment(desc);
if(adaptor != null)
adaptor.adaptPropertyBool(prop, prop.getBoolean(default_));
return prop.getBoolean(default_);
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public void onWorldStop()
{
// populate new data
for( final GridStorageSearch gs : this.loadedStorage.keySet() )
{
final GridStorage thisStorage = gs.getGridStorage().get();
if( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() )
{
final String value = thisStorage.getValue();
this.config.get( GRID_STORAGE_CATEGORY, String.valueOf( thisStorage.getID() ), value ).set( value );
}
}
this.config.save();
}
}
代码示例来源:origin: Vazkii/Botania
private static void loadFromConfig(Configuration config, String key, ShedPattern defaultPattern) {
String itemName = "";
int metadata = 0;
int rate = -1;
int lexiconSize = 40;
if(defaultPattern != null) {
itemName = Item.REGISTRY.getNameForObject(defaultPattern.getItemStack().getItem()).toString();
metadata = defaultPattern.getItemStack().getItemDamage();
rate = defaultPattern.rate;
lexiconSize = defaultPattern.lexiconSize;
}
Property prop = config.get("Shedding", key + ".item", itemName);
prop.setComment("Configuration of Shedding for "+key);
itemName = prop.getString();
rate = config.get("Shedding", key + ".rate", rate).getInt();
metadata = config.get("Shedding", key + ".metadata", metadata).getInt();
lexiconSize = config.get("Shedding", key + ".lexiconDisplaySize", lexiconSize).getInt();
if(itemName != null && Item.REGISTRY.getObject(new ResourceLocation(itemName)) != null && rate != -1)
patterns.add(new ShedPattern(EntityList.getClass(new ResourceLocation(key)), new ItemStack(Item.REGISTRY.getObject(new ResourceLocation(itemName)), 1, metadata), rate, lexiconSize));
}
代码示例来源:origin: Vazkii/Psi
public static int loadPropInt(String propName, String desc, int default_) {
Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, default_);
prop.setComment(desc);
// if(adaptor != null)
// adaptor.adaptPropertyInt(prop, prop.getInt(default_));
return prop.getInt(default_);
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public boolean isModuleEnabled(IForestryModule module) {
ForestryModule info = module.getClass().getAnnotation(ForestryModule.class);
String comment = ForestryPluginUtil.getComment(module);
Property prop = getModulesConfig().get(CONFIG_CATEGORY, info.moduleID(), true, comment);
return prop.getBoolean();
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public boolean isModuleEnabled(IForestryModule module) {
ForestryModule info = module.getClass().getAnnotation(ForestryModule.class);
String comment = ForestryPluginUtil.getComment(module);
Property prop = getModulesConfig().get(CONFIG_CATEGORY, info.moduleID(), true, comment);
return prop.getBoolean();
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
protected @Nullable Things makeValue() {
Property prop = owner.getConfig().get(section, keyname, defaultValue.getNameList().toArray(new String[0]));
prop.setLanguageKey(keyname);
prop.setValidValues(null);
prop.setComment(getText() + " [default: " + prop.getDefault() + "]");
prop.setRequiresMcRestart(isStartup);
return new Things(prop.getStringList());
}
内容来源于网络,如有侵权,请联系作者删除!