本文整理汇总了Java中net.minecraft.world.GameRules.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java GameRules.getBoolean方法的具体用法?Java GameRules.getBoolean怎么用?Java GameRules.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.GameRules
的用法示例。
在下文中一共展示了GameRules.getBoolean方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rainOverrideGR
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.NORMAL)
public void rainOverrideGR (TickEvent.ServerTickEvent event) {
WorldInfo worldinfo = GameInfo.worldInfo;
GameRules gameRules = GameInfo.gameRules;
try {
if (!gameRules.getBoolean("doWeather")) {
gameRules.setOrCreateGameRule("doWeather", "true");
gameRules.setOrCreateGameRule("doWeatherCycle", "false");
LogHelper.info("Switched weather GameRule over to Vanilla GameRule.");
}
}
catch (Exception e) {
LogHelper.error("Exception in RainOverride: " + e);
}
}
示例2: tickWorld
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
public void tickWorld(WorldTickEvent event) {
if(!(event.world instanceof WorldServer))
return;
// System.out.println("TICKING WORLD -> @" + event.world);
// TaleCraft.proxy.tick(event);
GameRules rules = event.world.getGameRules();
//TODO: Fix this
if(rules.getBoolean("tc_disableWeather")) {
// Clear the weather for 5 seconds.
event.world.getWorldInfo().setCleanWeatherTime(20*5);
}
NBTTagCompound current = rules.writeToNBT();
if(!current.equals(gamerules)){
gamerules = current;
TaleCraft.network.sendToAll(new GameruleSyncPacket(current));
}
}
示例3: func_175773_a
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
public static void func_175773_a(GameRules p_175773_0_, String p_175773_1_)
{
if ("reducedDebugInfo".equals(p_175773_1_))
{
byte b0 = (byte)(p_175773_0_.getBoolean(p_175773_1_) ? 22 : 23);
for (EntityPlayerMP entityplayermp : MinecraftServer.getServer().getConfigurationManager().func_181057_v())
{
entityplayermp.playerNetServerHandler.sendPacket(new S19PacketEntityStatus(entityplayermp, b0));
}
}
}
示例4: notifyGameRuleChange
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
public static void notifyGameRuleChange(GameRules rules, String p_184898_1_, MinecraftServer server)
{
if ("reducedDebugInfo".equals(p_184898_1_))
{
byte b0 = (byte)(rules.getBoolean(p_184898_1_) ? 22 : 23);
for (EntityPlayerMP entityplayermp : server.getPlayerList().getPlayerList())
{
entityplayermp.connection.sendPacket(new SPacketEntityStatus(entityplayermp, b0));
}
}
}
示例5: func_175773_a
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
public static void func_175773_a(GameRules p_175773_0_, String p_175773_1_)
{
if ("reducedDebugInfo".equals(p_175773_1_))
{
byte b0 = (byte) (p_175773_0_.getBoolean(p_175773_1_) ? 22 : 23);
for (EntityPlayerMP entityplayermp : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayers())
{
entityplayermp.connection.sendPacket(new SPacketEntityStatus(entityplayermp, b0));
}
}
}
示例6: notifyGameRuleChange
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
static void notifyGameRuleChange(GameRules rules, String key, World world)
{
if (key.equals("reducedDebugInfo"))
{
byte opCode = (byte)(rules.getBoolean(key) ? 22 : 23);
for (EntityPlayerMP player : world.getPlayers(EntityPlayerMP.class, Predicates.alwaysTrue()))
{
player.connection.sendPacket(new SPacketEntityStatus(player, opCode));
}
}
}
示例7: onPlayerDrops
import net.minecraft.world.GameRules; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
public void onPlayerDrops(PlayerDropsEvent event) {
World world = event.getEntityPlayer().world;
if (world.isRemote) return;
if (Config.debugGraves) dumpDebugInfo(event);
final EntityPlayer player = event.getEntityPlayer();
if (OpenBlocks.Blocks.grave == null) {
Log.log(debugLevel(), "OpenBlocks graves disabled, not placing (player '%s')", player);
return;
}
if (player instanceof FakePlayer) {
Log.debug("'%s' (%s) is a fake player, grave will not be spawned", player, player.getClass());
return;
}
if (event.isCanceled()) {
Log.warn("Event for player '%s' cancelled, grave will not be spawned", player);
return;
}
final List<EntityItem> drops = event.getDrops();
if (drops.isEmpty()) {
Log.log(debugLevel(), "No drops from player '%s', grave will not be spawned'", player);
return;
}
final GameRules gameRules = world.getGameRules();
if (gameRules.getBoolean("keepInventory") ||
!gameRules.getBoolean(GameRule.SPAWN_GRAVES)) {
Log.log(debugLevel(), "Graves disabled by gamerule (player '%s')", player);
return;
}
final GraveDropsEvent dropsEvent = new GraveDropsEvent(player);
for (EntityItem drop : drops)
dropsEvent.addItem(drop);
if (MinecraftForge.EVENT_BUS.post(dropsEvent)) {
Log.warn("Grave drops event for player '%s' cancelled, grave will not be spawned'", player);
return;
}
final List<EntityItem> graveLoot = Lists.newArrayList();
drops.clear(); // will be rebuilt based from event
for (GraveDropsEvent.ItemAction entry : dropsEvent.drops) {
switch (entry.action) {
case DELETE:
if (Config.debugGraves) Log.info("Item %s is going to be deleted", entry.item);
break;
case DROP:
if (Config.debugGraves) Log.info("Item %s is going to be dropped", entry.item);
drops.add(entry.item);
break;
default:
case STORE:
graveLoot.add(entry.item);
}
}
if (graveLoot.isEmpty()) {
Log.log(debugLevel(), "No grave drops left for player '%s' after event filtering, grave will not be spawned'", player);
return;
}
if (!tryConsumeGrave(player, Iterables.concat(graveLoot, drops))) {
Log.log(debugLevel(), "No grave in drops for player '%s' after firing event, grave will not be spawned'", player);
drops.addAll(graveLoot); // re-add any loot that would have gone to grave
return;
}
Log.log(debugLevel(), "Scheduling grave placement for player '%s':'%s' with %d item(s) stored and %d item(s) dropped",
player, player.getGameProfile(), graveLoot.size(), drops.size());
DelayedActionTickHandler.INSTANCE.addTickCallback(world, new GraveCallable(world, player, graveLoot));
}