本文整理汇总了Java中net.minecraft.world.WorldServer.isRaining方法的典型用法代码示例。如果您正苦于以下问题:Java WorldServer.isRaining方法的具体用法?Java WorldServer.isRaining怎么用?Java WorldServer.isRaining使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.WorldServer
的用法示例。
在下文中一共展示了WorldServer.isRaining方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTimeAndWeatherForPlayer
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
/**
* Updates the time and weather for the given player to those of the given world
*/
public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn)
{
WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder();
playerIn.connection.sendPacket(new SPacketWorldBorder(worldborder, SPacketWorldBorder.Action.INITIALIZE));
playerIn.connection.sendPacket(new SPacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle")));
BlockPos blockpos = worldIn.getSpawnPoint();
playerIn.connection.sendPacket(new SPacketSpawnPosition(blockpos));
if (worldIn.isRaining())
{
playerIn.connection.sendPacket(new SPacketChangeGameState(1, 0.0F));
playerIn.connection.sendPacket(new SPacketChangeGameState(7, worldIn.getRainStrength(1.0F)));
playerIn.connection.sendPacket(new SPacketChangeGameState(8, worldIn.getThunderStrength(1.0F)));
}
}
示例2: updateTimeAndWeatherForPlayer
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
/**
* Updates the time and weather for the given player to those of the given world
*/
public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn)
{
WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder();
playerIn.playerNetServerHandler.sendPacket(new S44PacketWorldBorder(worldborder, S44PacketWorldBorder.Action.INITIALIZE));
playerIn.playerNetServerHandler.sendPacket(new S03PacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle")));
if (worldIn.isRaining())
{
playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F));
playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, worldIn.getRainStrength(1.0F)));
playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, worldIn.getThunderStrength(1.0F)));
}
}
示例3: onWorldTick
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
@SubscribeEvent
public static void onWorldTick(WorldTickEvent event) {
WorldServer world = (WorldServer) event.world;
if (world.isRaining()) {
onTickSnowIncrease(world);
} else if (world.provider.isDaytime()) {
onTickSnowDecrease(world);
}
}
示例4: teleportPlayerToDimension
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
private static void teleportPlayerToDimension(EntityPlayerMP playerIn, int suggestedDimensionId, double x, double y, double z) {
WorldServer fromWorld = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(playerIn.dimension);
WorldServer toWorld = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(suggestedDimensionId);
playerIn.dimension = toWorld.provider.getDimension();
ChunkPos pos = new ChunkPos(playerIn.getPosition());
toWorld.getChunkProvider().loadChunk(pos.x, pos.z);
final int dimensionId = playerIn.dimension;
if (fromWorld != toWorld && fromWorld.provider.getDimensionType() == toWorld.provider.getDimensionType()) {
playerIn.connection.sendPacket(new SPacketRespawn((dimensionId >= 0 ? -1 : 0), toWorld.getDifficulty(), toWorld.getWorldInfo().getTerrainType(), playerIn.interactionManager.getGameType()));
}
playerIn.connection.sendPacket(new SPacketRespawn(dimensionId, toWorld.getDifficulty(), toWorld.getWorldInfo().getTerrainType(), playerIn.interactionManager.getGameType()));
fromWorld.removeEntityDangerously(playerIn);
playerIn.isDead = false;
playerIn.connection.setPlayerLocation(x, y, z, playerIn.rotationYaw, playerIn.rotationPitch);
playerIn.world = toWorld;
playerIn.setWorld(toWorld);
toWorld.spawnEntity(playerIn);
toWorld.updateEntityWithOptionalForce(playerIn, false);
WorldServer worldserver = playerIn.getServerWorld();
fromWorld.getPlayerChunkMap().removePlayer(playerIn);
worldserver.getPlayerChunkMap().addPlayer(playerIn);
worldserver.getChunkProvider().provideChunk((int)playerIn.posX >> 4, (int)playerIn.posZ >> 4);
playerIn.connection.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch);
playerIn.interactionManager.setWorld(toWorld);
WorldBorder worldborder = FMLCommonHandler.instance().getMinecraftServerInstance().worlds[0].getWorldBorder();
playerIn.connection.sendPacket(new SPacketWorldBorder(worldborder, SPacketWorldBorder.Action.INITIALIZE));
playerIn.connection.sendPacket(new SPacketTimeUpdate(toWorld.getTotalWorldTime(), toWorld.getWorldTime(), toWorld.getGameRules().getBoolean("doDaylightCycle")));
if (toWorld.isRaining()) {
playerIn.connection.sendPacket(new SPacketChangeGameState(1, 0.0F));
playerIn.connection.sendPacket(new SPacketChangeGameState(7, toWorld.getRainStrength(1.0F)));
playerIn.connection.sendPacket(new SPacketChangeGameState(8, toWorld.getThunderStrength(1.0F)));
}
playerIn.sendContainerToPlayer(playerIn.inventoryContainer);
playerIn.setPlayerHealthUpdated();
playerIn.connection.sendPacket(new SPacketHeldItemChange(playerIn.inventory.currentItem));
}
示例5: updateTimeAndWeatherForPlayer
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
/**
* Updates the time and weather for the given player to those of the given world
*/
public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn)
{
WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder();
playerIn.connection.sendPacket(new SPacketWorldBorder(worldborder, SPacketWorldBorder.Action.INITIALIZE));
playerIn.connection.sendPacket(new SPacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle")));
if (worldIn.isRaining())
{
playerIn.connection.sendPacket(new SPacketChangeGameState(1, 0.0F));
playerIn.connection.sendPacket(new SPacketChangeGameState(7, worldIn.getRainStrength(1.0F)));
playerIn.connection.sendPacket(new SPacketChangeGameState(8, worldIn.getThunderStrength(1.0F)));
}
}