本文整理汇总了Java中net.minecraft.world.GameRules.addGameRule方法的典型用法代码示例。如果您正苦于以下问题:Java GameRules.addGameRule方法的具体用法?Java GameRules.addGameRule怎么用?Java GameRules.addGameRule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.GameRules
的用法示例。
在下文中一共展示了GameRules.addGameRule方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerGameRules
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
public static void registerGameRules(GameRules rules){
rules.addGameRule("tc_playDefaultMusic", "true", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_disableInvokeSystem", "false", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_visualEventDebugging", "false", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_disableTeleporter", "false", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_disableWeather", "false", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_disable.damage.*", "false", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_disable.damage.fall", "false", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_disable.damage.drown", "false", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_disable.damage.lava", "false", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_disable.damage.magic", "false", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_disable.damage.fire", "false", GameRules.ValueType.BOOLEAN_VALUE);
rules.addGameRule("tc_disable.damage.suffocate", "false", GameRules.ValueType.BOOLEAN_VALUE);
}
示例2: createGameruleIfAbsent
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
private boolean createGameruleIfAbsent(GameRules gameRule, String gameruleName, boolean value) {
boolean added = false;
if (!gameRule.hasRule(gameruleName)) {
gameRule.addGameRule(gameruleName, Boolean.toString(value));
added = true;
}
ProjectZuluLog.info("Gamerule %s is set to %s", gameruleName, gameRule.getGameRuleBooleanValue(gameruleName));
return added;
}
示例3: serverStarting
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
@Override
public void serverStarting(FMLServerStartingEvent event, File configDirectory) {
/* Add Custom GameRules */
GameRules gameRule = event.getServer().worldServerForDimension(0).getGameRules();
/* Add Does Campfire Burn GameRule: Only if not Present */
String ruleName = "doesCampfireBurn";
if (!gameRule.hasRule(ruleName)) {
gameRule.addGameRule(ruleName, "false");
}
}
示例4: addRule
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
private void addRule(GameRules rules, String key, String val) {
if (!rules.hasRule(key)) {
rules.addGameRule(key, val);
}
}
示例5: addRule
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
private static void addRule(GameRules rules, String name, String defaultValue) {
if (!rules.hasRule(name)) rules.addGameRule(name, defaultValue, GameRules.ValueType.BOOLEAN_VALUE);
}
示例6: initialize
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
/**
* Initializes the GameRule for a world.
*
* @param world The world to initialize for.
*/
public void initialize (World world) {
final GameRules rules = world.getGameRules();
if (!rules.hasRule(this.getId())) {
rules.addGameRule(this.getId(), String.valueOf(this.getDefaultState()), ValueType.BOOLEAN_VALUE);
}
}