本文整理汇总了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;
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例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;
}
}
示例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();
}
}
}
}
}
示例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;
}
}
示例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();
}
}
}
}
}
}
示例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();
}
示例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();
}
}
}
示例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 );
}
示例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();
}
示例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();
}
}
示例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;
}
}
示例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();
}
}