当前位置: 首页>>代码示例>>Java>>正文


Java WorldServer.tick方法代码示例

本文整理汇总了Java中net.minecraft.world.WorldServer.tick方法的典型用法代码示例。如果您正苦于以下问题:Java WorldServer.tick方法的具体用法?Java WorldServer.tick怎么用?Java WorldServer.tick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.WorldServer的用法示例。


在下文中一共展示了WorldServer.tick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateTimeLightAndEntities

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void updateTimeLightAndEntities()
{
    this.theProfiler.startSection("jobs");

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

    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.serverConfigManager.sendPacketToAllPlayersInDimension(new S03PacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionId());
                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.serverConfigManager.onTick();
    this.theProfiler.endStartSection("tickables");

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

    this.theProfiler.endSection();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:78,代码来源:MinecraftServer.java

示例2: updateTimeLightAndEntities

import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
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();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:78,代码来源:MinecraftServer.java


注:本文中的net.minecraft.world.WorldServer.tick方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。