Java 类cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent 实例源码

项目:Structures    文件:ResidentSpawner.java   
@SubscribeEvent
public void update(ServerTickEvent evt) {
  long curTime = world.getTotalWorldTime();
  if(curTime % checkPeriod != 0) {
    return;
  }

  if(preCondition != null && !preCondition.isConditionMet(world, structure, worldPos)) {
    return;
  }

  int curNum = getNumResidentsInHomeBounds();
  if(curNum >= numSpawned) { //TODO: Optional to wait for all to be dead?
    lastTimePresent = world.getTotalWorldTime();
  } else if(curTime - lastTimePresent >= respawnRate) {
    spawnResidents(numSpawned - curNum);
  }
}
项目:TickDynamic    文件:TickDynamicMod.java   
@SubscribeEvent(priority=EventPriority.LOWEST)
public void tickEventEnd(ServerTickEvent event) {   
    if(event.phase == Phase.END)
    {
    getTimedGroup("other").endTimer();
    root.endTick(true);

    if(debugTimer)
        System.out.println("Tick time used: " + (root.getTimeUsed()/root.timeMilisecond) + "ms");

    //After every world is done ticking, re-balance the time slices according
    //to the data gathered during the tick.
    root.balanceTime();

    //Calculate TPS
    updateTPS();

    if(saveConfig)
    {
        saveConfig = false;
        config.save();
    }
    }
}
项目:Farrago    文件:FarragoMod.java   
@SubscribeEvent
public void onTick(ServerTickEvent e) {
    if (e.phase == Phase.END) {
        if (!chunksToGen.isEmpty()) {
            GenData data = chunksToGen.pop();
            Chunk chunk = data.chunk;
            if (data.level == 0) {
                yttrGen.generate(chunk.worldObj.rand, chunk.xPosition, chunk.zPosition, chunk.worldObj, null, null);
            } else if (data.level == 1) {
                xenoGen.generate(chunk.worldObj.rand, chunk.xPosition, chunk.zPosition, chunk.worldObj, null, null);
            }
            chunk.setChunkModified();
            log.info("Retrogenerating "+chunk.xPosition+", "+chunk.zPosition);
        }
    }
}
项目:4Space-5    文件:TransmitterNetworkRegistry.java   
@SubscribeEvent
public void onTick(ServerTickEvent event)
{
    if(event.phase == Phase.END && event.side == Side.SERVER)
    {
        tickEnd();
    }
}
项目:VivecraftForgeExtensions    文件:HandlerServerTick.java   
@SubscribeEvent
public void onServerTick(ServerTickEvent event) {
    if (event.phase == Phase.START) {
        for (Iterator<Map.Entry<EntityPlayer, VRPlayerData>> it = ProxyServer.vrPlayers.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry<EntityPlayer, VRPlayerData> entry = it.next();
            EntityPlayer player = entry.getKey();
            if (player.isDead) {
                it.remove();
                continue;
            }
            VRPlayerData data = entry.getValue();
            if (data.entities.size() != (data.seated ? 1 : 3)) {
                createEntities(player, data);
            } else {
                for (EntityVRObject entity : data.entities) {
                    //System.out.println(entity.getClass().getSimpleName() + " " + entity.posX + " " + entity.posY + " " + entity.posZ);
                    if (!entity.isSpawned()) {
                        if (entity.worldObj.spawnEntityInWorld(entity)) entity.setSpawned();
                    }
                    if (entity.isDead || entity.worldObj != player.worldObj) {
                        createEntities(player, data);
                        break;
                    }
                }
            }
        }
    }
}
项目:EEWReciever    文件:QuakeEventExecutor.java   
@SubscribeEvent
public void onServerTick(final ServerTickEvent event) {
    try {
        for (final IQuake quake : this.quakes) {
            final Queue<IQuakeNode> nodes = quake.getQuakeUpdate();
            IQuakeNode line;
            while ((line = nodes.poll())!=null)
                EEWReciever2.EVENT_BUS.post(line.getEvent());
        }
    } catch (final QuakeException e) {
        Reference.logger.error(e.getMessage(), e);
    }
}
项目:LambdaLib    文件:LIFMLGameEventDispatcher.java   
@SubscribeEvent
public void onServerTick(ServerTickEvent event) {
    if (!addServerTick.isEmpty()) {
        hServerTick.addAll(addServerTick);
        addServerTick.clear();
    }
    for (Iterator<LIHandler> it = hServerTick.iterator(); it.hasNext(); ) {
        LIHandler handler = it.next();
        if (handler.isDead())
            it.remove();
        else
            handler.trigger(event);
    }
}
项目:Structures    文件:ServerTickBehaviour.java   
@SubscribeEvent
public void update(ServerTickEvent evt) {
  long curTime = world.getTotalWorldTime();
  if(executionInterval > 0 && curTime % executionInterval != 0) {
    return;
  }
  if(condition != null && !condition.isConditionMet(world, structure, worldPosition)) {
    return;
  }
  if(action != null) {      
    action.doAction(world, structure, worldPosition);
  }
}
项目:Structures    文件:DeferedActionHandler.java   
@SubscribeEvent
public void update(ServerTickEvent evt) {
  ListIterator<TimedAction> iter = deferedActions.listIterator();
  while(iter.hasNext()) {
    TimedAction action = iter.next();
    if(action.performThisTick()) {
      iter.remove();
    }
  }
}
项目:GameAnalyticsAPI    文件:ActivityReportTickEventHandler.java   
@SuppressWarnings("static-method")
@SideOnly(Side.SERVER)
@SubscribeEvent
public void serverTick(ServerTickEvent event) {
    if (event.phase == Phase.START) {
        sendAnalyticsActivityEvent();
    }
}
项目:EnderCore    文件:Scheduler.java   
/**
 * For internal use only. Do not call.
 */
@SubscribeEvent
public void onServerTick(ServerTickEvent event) {
  if (event.phase == Phase.END) {
    runTasks(serverQueue);
  }
}
项目:vsminecraft    文件:TransmitterNetworkRegistry.java   
@SubscribeEvent
public void onTick(ServerTickEvent event)
{
    if(event.phase == Phase.END && event.side == Side.SERVER)
    {
        tickEnd();
    }
}
项目:EnderIOAddons    文件:Manager.java   
@SubscribeEvent
public void onTick(ServerTickEvent evt) {
  if (evt.phase == Phase.END) {
    for (Entry<INetworkUpdatable, Integer> entry : networkUpdatables.entrySet()) {
      final INetworkUpdatable te = entry.getKey();
      if (te != null) {
        int i = entry.getValue();
        if (i-- <= 0) {
          int[] data = networkUpdatableData.get(te);
          boolean needUpdate = false;
          for (int j = 0; j < data.length; j++) {
            int value = te.getNetworkUpdate(j);
            if (value != data[j]) {
              data[j] = value;
              needUpdate = true;
            }
          }
          if (needUpdate) {
            PacketHandler.sendToAllAround(new PacketNetworkUpdate((TileEntity) te, data), (TileEntity) te);
          }
          entry.setValue(te.getNetworkUpdateCheckInterval());
        } else {
          entry.setValue(i);
        }
      }
    }
  }
}
项目:EnderIOAddons    文件:Ticker.java   
@SubscribeEvent
public void onTick(ServerTickEvent evt) {
  if (evt.phase == Phase.END && !queue.isEmpty()) {
    Runnable task = queue.poll();
    if (task != null) {
      task.run();
    }
  }
}
项目:NightfallMod    文件:MooklabTickHandler.java   
@SubscribeEvent
private void tickStartChecker(ServerTickEvent event) {
    if (event.phase == Phase.START) {
        tickStart();

    }
}
项目:Framez    文件:MovementScheduler.java   
@SubscribeEvent
public void onServerTick(ServerTickEvent event) {

    if (Framez.proxy.isGamePaused())
        return;

    for (World w : MinecraftServer.getServer().worldServers)
        tick(w, event.phase);
}
项目:rpginventory    文件:CommonTickHandlerRpgPlus.java   
@SubscribeEvent
public void onServerTick(ServerTickEvent ev) {

    /*
     * Manage cooldown mapused for spawning minions
     */
    for (Entry<String, Integer> entry : rpgPluscooldownMap.entrySet()) {
        if (entry.getValue() > 0) {
            entry.setValue(entry.getValue() - 1);
        }
    }
}
项目:E-Mobile    文件:CellphoneSessionsHandler.java   
@SubscribeEvent
public void tickEnd(ServerTickEvent evt) {
    if (evt.phase == Phase.END) {
        Iterator<CellphoneSessionBase> itr = sessions.iterator();
        while (itr.hasNext()) {
            CellphoneSessionBase session = itr.next();
            session.tick();
            if (!session.isValid()) {
                itr.remove();
            }
        }
    }
}
项目:NausicaaMod    文件:MooklabTickHandler.java   
@SubscribeEvent
private void tickStartChecker(ServerTickEvent event) {
    if (event.phase == Phase.START) {
        tickStart();

    }
}
项目:MinecraftScripting    文件:ServerTickHandler.java   
@SuppressWarnings("unchecked")
@SubscribeEvent
public void tickEnd(ServerTickEvent event) {
    if (event.phase == Phase.START) {
        if (lastThread != Thread.currentThread()) { 
            lastThread = Thread.currentThread();
            ScriptingMod.instance.clearSelections();
            core = new ServerCore(loadDir, props, abbreviations);
        }
        core.tick();

        List<EntityPlayerMP> players = (List<EntityPlayerMP>) MinecraftServer.getServer().getConfigurationManager().playerEntityList;
        ScriptingMod.instance.updateSelections(players);
    }
}
项目:TickDynamic    文件:TickDynamicMod.java   
@SubscribeEvent(priority=EventPriority.HIGHEST)
public void tickEventStart(ServerTickEvent event) {
    if(event.phase == Phase.START)
    {
        if(!versionCheckDone)
        {
            VersionChecker.VersionData versionData = versionChecker.getVersionData();
            if(versionData != null)
            {
                versionCheckDone = true;
                if(versionData.checkOk)
                {
                //TODO: Parse versions, split at ',', then split version numbers at '.'
                System.out.println("TickDynamic version check: Latest version = " + versionData.modVersion + ". Download URL: http://" + versionData.updateUrl);
                }
                else
                    System.out.println("TickDynamic version check: Error while checking latest version!");
            }
        }

        TimedGroup externalGroup = getTimedGroup("external");
        externalGroup.endTimer();

        //Set the correct externalGroup time
        long msPerTick = 50;
        long overTime = externalGroup.getTimeUsed() - (msPerTick*externalGroup.timeMilisecond); //overTime = time used above given tick time
        long overTimeTick = (msPerTick*externalGroup.timeMilisecond) - (root.getTimeUsed() - externalGroup.getTimeUsed());
        if(overTimeTick < 0)
            overTime += overTimeTick;
        /*System.out.println("TickTime: " + ((root.getTimeUsed()-externalGroup.getTimeUsed())/(double)externalGroup.timeMilisecond) + 
                " Full Tick time: " + (externalGroup.getTimeUsed()/(double)externalGroup.timeMilisecond) +
                " External time used: " + (overTime/(double)externalGroup.timeMilisecond)+"ms");*/
        if(overTime < 0)
            externalGroup.setTimeUsed(0);
        else
            externalGroup.setTimeUsed(overTime);

        externalGroup.startTimer();


     //Clear any values from the previous tick for all worlds.
        root.newTick(true);

        getTimedGroup("other").startTimer();
    }
}
项目:Open-Exchange    文件:TileSync.java   
@SubscribeEvent
public void tickServer(ServerTickEvent tick) {
  if (tick.phase == Phase.END) {
    syncServer();
  }
}
项目:MobSpawnControls2    文件:MobSpawnControls.java   
@SubscribeEvent
public void onServerTick(ServerTickEvent event) {
    ticker.tick();
}
项目:rpginventory    文件:ServerTickHandler.java   
@SubscribeEvent
public void onServerTick(ServerTickEvent ev) {

    this.updateGlobalCooldownMap();

    this.sendInventoryToAllAround();

    this.updateDiamondJewelryEffect();

    this.updateLapisJewelryEffect();

}