Java 类net.minecraft.network.play.server.SPacketTimeUpdate 实例源码

项目:Backmemed    文件:PlayerList.java   
/**
 * 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)));
    }
}
项目:ForgeHax    文件:TickRateService.java   
@SubscribeEvent
public void onPacketPreceived(PacketEvent.Incoming.Pre event) {
    if(event.getPacket() instanceof SPacketTimeUpdate) {
        if(timeLastTimeUpdate != -1) {
            TICK_DATA.onTimePacketIncoming(System.currentTimeMillis() - timeLastTimeUpdate);
        }
        timeLastTimeUpdate = System.currentTimeMillis();
    }
}
项目:CustomWorldGen    文件:PlayerList.java   
/**
 * 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)));
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
public void handleTimeUpdate(SPacketTimeUpdate packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.world.setTotalWorldTime(packetIn.getTotalWorldTime());
    this.gameController.world.setWorldTime(packetIn.getWorldTime());
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
public void handleTimeUpdate(SPacketTimeUpdate packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.world.setTotalWorldTime(packetIn.getTotalWorldTime());
    this.gameController.world.setWorldTime(packetIn.getWorldTime());
}
项目:Backmemed    文件:MinecraftServer.java   
public void updateTimeLightAndEntities()
{
    this.theProfiler.startSection("jobs");

    synchronized (this.futureTaskQueue)
    {
        while (!this.futureTaskQueue.isEmpty())
        {
            Util.runTask((FutureTask)this.futureTaskQueue.poll(), LOG);
        }
    }

    this.theProfiler.endStartSection("levels");

    for (int j = 0; j < this.worldServers.length; ++j)
    {
        long i = System.nanoTime();

        if (j == 0 || this.getAllowNether())
        {
            WorldServer worldserver = this.worldServers[j];
            this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());

            if (this.tickCounter % 20 == 0)
            {
                this.theProfiler.startSection("timeSync");
                this.playerList.sendPacketToAllPlayersInDimension(new SPacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionType().getId());
                this.theProfiler.endSection();
            }

            this.theProfiler.startSection("tick");

            try
            {
                worldserver.tick();
            }
            catch (Throwable throwable1)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world");
                worldserver.addWorldInfoToCrashReport(crashreport);
                throw new ReportedException(crashreport);
            }

            try
            {
                worldserver.updateEntities();
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities");
                worldserver.addWorldInfoToCrashReport(crashreport1);
                throw new ReportedException(crashreport1);
            }

            this.theProfiler.endSection();
            this.theProfiler.startSection("tracker");
            worldserver.getEntityTracker().updateTrackedEntities();
            this.theProfiler.endSection();
            this.theProfiler.endSection();
        }

        this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i;
    }

    this.theProfiler.endStartSection("connection");
    this.getNetworkSystem().networkTick();
    this.theProfiler.endStartSection("players");
    this.playerList.onTick();
    this.theProfiler.endStartSection("tickables");

    for (int k = 0; k < this.tickables.size(); ++k)
    {
        ((ITickable)this.tickables.get(k)).update();
    }

    this.theProfiler.endSection();
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
public void handleTimeUpdate(SPacketTimeUpdate packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.theWorld.setTotalWorldTime(packetIn.getTotalWorldTime());
    this.gameController.theWorld.setWorldTime(packetIn.getWorldTime());
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
public void handleTimeUpdate(SPacketTimeUpdate packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    this.gameController.theWorld.setTotalWorldTime(packetIn.getTotalWorldTime());
    this.gameController.theWorld.setWorldTime(packetIn.getWorldTime());
}
项目:Backmemed    文件:INetHandlerPlayClient.java   
void handleTimeUpdate(SPacketTimeUpdate packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayClient.java   
void handleTimeUpdate(SPacketTimeUpdate packetIn);