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


Java TickEvent.ServerTickEvent方法代码示例

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


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

示例1: onWorldTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
@SuppressWarnings("unchecked")
public void onWorldTick(TickEvent.ServerTickEvent event) {
	if (event.phase != TickEvent.Phase.END || event.side != Side.SERVER)
		return;

	if (EtFuturum.enablePlayerSkinOverlay)
		if (playerLoggedInCooldown != null)
			if (--playerLoggedInCooldown <= 0) {
				for (World world : MinecraftServer.getServer().worldServers)
					for (EntityPlayer player : (List<EntityPlayer>) world.playerEntities) {
						NBTTagCompound nbt = player.getEntityData();
						if (nbt.hasKey(SetPlayerModelCommand.MODEL_KEY, Constants.NBT.TAG_BYTE)) {
							boolean isAlex = nbt.getBoolean(SetPlayerModelCommand.MODEL_KEY);
							EtFuturum.networkWrapper.sendToAll(new SetPlayerModelMessage(player, isAlex));
						}
					}
				playerLoggedInCooldown = null;
			}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:21,代码来源:ServerEventHandler.java

示例2: onServerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(final TickEvent.ServerTickEvent event) {
    if (event.phase != TickEvent.Phase.END || CommandTPSTimer.playerSet.isEmpty()) {
        return;
    }
    final MinecraftServer server = MinecraftServer.getServer();
    final int counter = server.getTickCounter() % 100;
    final long[] longs = server.tickTimeArray;
    if (longs == null) {
        return;
    }
    for (final Object o : server.getConfigurationManager().playerEntityList) {
        final EntityPlayer player = (EntityPlayer)o;
        if (CommandTPSTimer.playerSet.contains(player.getCommandSenderName())) {
            NetworkHandler.sendPacketToPlayer(new PacketTime(longs[counter], counter), player);
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:19,代码来源:CommandTPSTimer.java

示例3: onServerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event)
{
	MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
	//Prevent issues when clients switch to LAN servers
	if (server == null) return;

	if (event.phase == TickEvent.Phase.START)
    {
        if (AsteroidsTickHandlerServer.spaceRaceData == null)
        {
            World world = server.worldServerForDimension(0);
            AsteroidsTickHandlerServer.spaceRaceData = (ShortRangeTelepadHandler) world.mapStorage.loadData(ShortRangeTelepadHandler.class, ShortRangeTelepadHandler.saveDataID);

            if (AsteroidsTickHandlerServer.spaceRaceData == null)
            {
                AsteroidsTickHandlerServer.spaceRaceData = new ShortRangeTelepadHandler(ShortRangeTelepadHandler.saveDataID);
                world.mapStorage.setData(ShortRangeTelepadHandler.saveDataID, AsteroidsTickHandlerServer.spaceRaceData);
            }
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:23,代码来源:AsteroidsTickHandlerServer.java

示例4: onTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onTick(TickEvent.ServerTickEvent e) {
    if (e.phase == TickEvent.Phase.START) {
        final Runnable[] adds;
        synchronized (pending) {
            adds = pending.toArray(new Runnable[pending.size()]);
            pending.clear();
        }
        for (Runnable runnable : adds) {
            try {
                runnable.run();
            } catch (Throwable t) {
                log.warn("Error in scheduled tick action.", t);
            }
        }
    }
}
 
开发者ID:Avaja,项目名称:OpenTechnology,代码行数:18,代码来源:SimpleComponentTickHandler.java

示例5: onEvent

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEvent(TickEvent.ServerTickEvent event)
{
    // Only need once a tick
    if(event.phase == TickEvent.Phase.START)
    {
        return;
    }

    // This is useless :p
    if(tickCount < TICK_DELAY)
    {
        tickCount++;
    }

    if(tickCount == TICK_DELAY)
    {
        InventoryPlayerUnificationHandler.unifyAll();
        tickCount = 0;
    }
}
 
开发者ID:Technici4n,项目名称:ProjectU,代码行数:22,代码来源:ServerTickEventHandler.java

示例6: tick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tick(TickEvent.ServerTickEvent event) {
	//Tick satellites
	if(event.phase == event.phase.END) {
		DimensionManager.getInstance().tickDimensions();
		time++;

		if(!transitionMap.isEmpty()) {
			Iterator<Entry<Long, TransitionEntity>> itr = transitionMap.entrySet().iterator();

			while(itr.hasNext()) {
				Entry<Long, TransitionEntity> entry = itr.next();
				TransitionEntity ent = entry.getValue();
				if(ent.entity.worldObj.getTotalWorldTime() >= entry.getKey()) {
					ent.entity.setLocationAndAngles(ent.location.x, ent.location.y, ent.location.z, ent.entity.rotationYaw, ent.entity.rotationPitch);

					MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)ent.entity, ent.dimId, new TeleporterNoPortal(MinecraftServer.getServer().worldServerForDimension(ent.dimId)));

					ent.entity.mountEntity(ent.entity2);
					itr.remove();
				}
			}
		}
	}
}
 
开发者ID:zmaster587,项目名称:AdvancedRocketry,代码行数:26,代码来源:PlanetEventHandler.java

示例7: onServerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
	
	if(DimensionManager.getWorld(Configuration.spaceDimId) == null)
		return;
	
	long worldTime = DimensionManager.getWorld(Configuration.spaceDimId).getTotalWorldTime();
	//Assuming server
	//If no dim undergoing transition then nextTransitionTick = -1
	if((nextStationTransitionTick != -1 && worldTime >= nextStationTransitionTick && spaceStationOrbitMap.get(WARPDIMID) != null) || (nextStationTransitionTick == -1 && spaceStationOrbitMap.get(WARPDIMID) != null && !spaceStationOrbitMap.get(WARPDIMID).isEmpty())) {
		long newNextTransitionTick = -1;
		for(ISpaceObject obj : spaceStationOrbitMap.get(WARPDIMID)) {
			if(obj.getTransitionTime() <= worldTime) {
				moveStationToBody(obj, obj.getDestOrbitingBody());
				spaceStationOrbitMap.get(WARPDIMID).remove(obj);
			}
			else if(newNextTransitionTick == -1 || obj.getTransitionTime() < newNextTransitionTick)
				newNextTransitionTick = obj.getTransitionTime();
		}

		nextStationTransitionTick = newNextTransitionTick;
	}

}
 
开发者ID:zmaster587,项目名称:AdvancedRocketry,代码行数:25,代码来源:SpaceObjectManager.java

示例8: onServerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
	if (event.phase == TickEvent.Phase.END) {
		this.ticksCounter++;
		if (this.ticksCounter > this.ticksPerCheck) {
			this.ticksCounter = 0;
			//check if any stuck players need message or teleport
			
			List<StuckPlayer> stuckListCopy = new ArrayList<StuckPlayer>(stuckList);
			for (StuckPlayer player : stuckListCopy) {
				if (player.isDoneWaiting()) {
					player.stuckTeleport();
					stuckList.remove(player);
				} else {
					boolean cancelled = player.considerCancelling();
					if (cancelled) {
						stuckList.remove(player);
					} else {
						player.considerSendingMessage();
					}
				}
			}
		}
	}
}
 
开发者ID:rockysims,项目名称:fortressmod,代码行数:26,代码来源:StuckCommand.java

示例9: onServerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event)
{
	Time current_time = new Time(System.currentTimeMillis());
	long timestamp = System.currentTimeMillis();

	if (event.phase == TickEvent.Phase.START
			|| !ConfigHandler.backupEnabled
			|| current_time.compareTo(nextSchedule) != 0
			|| YABM.backupManager.isRunning()
			|| timestamp < (lastRun + 60000))
	{
		return;
	}

	YABM.backupManager.startBackup();
	updateScheduleTime();
	lastRun = System.currentTimeMillis();
}
 
开发者ID:szernex,项目名称:YetAnotherBackupMod,代码行数:20,代码来源:BackupTickHandler.java

示例10: tick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tick(TickEvent.ServerTickEvent event) {
    if (event.phase == TickEvent.Phase.START)
        return;

    Iterator<DelayedCommand> delayedIterator = delayedCommands.iterator();
    while (delayedIterator.hasNext()) {
        DelayedCommand delayedCommand = delayedIterator.next();

        delayedCommand.timer--;
        if (delayedCommand.timer <= 0) {
            CommandHandler ch = (CommandHandler) MinecraftServer.getServer().getCommandManager();
            LoreCommandSender commandSender = new LoreCommandSender(delayedCommand.getPlayer());

            for (String command : delayedCommand.commands) {
                ch.executeCommand(commandSender, command);
            }

            delayedIterator.remove();
        }
    }
}
 
开发者ID:dmillerw,项目名称:LoreExpansion_old,代码行数:23,代码来源:CommandDelayHandler.java

示例11: onServerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
/** Uses lowest event priority to run after everything else has */
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onServerTick(TickEvent.ServerTickEvent event)
{
    // Only run at end of tick to catch players that just moved past border
    if (event.phase == TickEvent.Phase.START)
        return;

    if ( WorldBorder.SERVER.getTickCounter() % Config.getTimerTicks() != 0 )
        return;

    for (Object o : WorldBorder.SERVER.getConfigurationManager().playerEntityList)
        BorderCheck.checkPlayer( (EntityPlayerMP) o, null, false, true );
}
 
开发者ID:RoyCurtis,项目名称:WorldBorder-Forge,代码行数:15,代码来源:BorderCheckTask.java

示例12: onServerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event)
{
	// check to skip this tick
	if (event.phase == TickEvent.Phase.START)
		return;

	if (System.currentTimeMillis() < nextScheduleTimestamp)
		return;

	if (BackupThread.backupLock.isLocked())
	{
		LogHelper.warn("Skipping to next scheduled backup because previous thread hasn't finished yet");
		ChatHelper.sendLocalizedServerChatMsg("yabm2.backup.error.thread_still_running");
		schedule();
		return;
	}

	// start backup
	LogHelper.info("Backup starting, prepare for lag");
	ChatHelper.sendLocalizedServerChatMsg("yabm2.backup.general.backup_starting");

	// turn off auto-save
	WorldHelper.disableWorldSaving();

	// start new backup thread
	BackupThread backup_thread = new BackupThread();

	LogHelper.info("Starting backup thread");
	backup_thread.start();

	// re-schedule next backup
	schedule();
}
 
开发者ID:szernex,项目名称:YetAnotherBackupMod2,代码行数:35,代码来源:BackupManager.java

示例13: tickServer

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tickServer(TickEvent.ServerTickEvent event)
{
    if ((this.timer.isDone()) &&
            (this.dirtyBarrels.size() > 0))
    {
        for (TileEntityBarrel barrel : (TileEntityBarrel[]) Arrays.copyOf(this.dirtyBarrels.keySet().toArray(), this.dirtyBarrels.size(),[Lmcp.mobius.betterbarrels.common.blocks.TileEntityBarrel.class)) {
        if (barrel != null) {
            barrel.markDirtyExec();
        }
    }
        this.dirtyBarrels.clear();
    }
}
 
开发者ID:Dennisbonke,项目名称:JABBA,代码行数:15,代码来源:ServerTickHandler.java

示例14: onServerTick

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
	serverTick++;

	if(serverTick % 200 == 0 /* 30 * 20 = 600 = ~30 seconds */) {
		serverTick = 0;
	}
}
 
开发者ID:unitedworldminers,项目名称:ClaimIO,代码行数:9,代码来源:EventBus.java

示例15: periodicallyQuery

import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void periodicallyQuery(TickEvent.ServerTickEvent event) {
    if (event.phase != TickEvent.Phase.END)
        return;

    ticksUntilQuery--;

    if (ticksUntilQuery <= 0) {
        ticksUntilQuery = 20 * 15;

        forceQuery();
    }
}
 
开发者ID:CannibalVox,项目名称:McDiscord,代码行数:14,代码来源:QueryDiscordHandler.java


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