本文整理汇总了Java中cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent类的典型用法代码示例。如果您正苦于以下问题:Java ServerTickEvent类的具体用法?Java ServerTickEvent怎么用?Java ServerTickEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerTickEvent类属于cpw.mods.fml.common.gameevent.TickEvent包,在下文中一共展示了ServerTickEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@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);
}
}
示例2: tickEventEnd
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@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();
}
}
}
示例3: onTick
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@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);
}
}
}
示例4: onTick
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(ServerTickEvent event)
{
if(event.phase == Phase.END && event.side == Side.SERVER)
{
tickEnd();
}
}
示例5: onServerTick
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@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;
}
}
}
}
}
}
示例6: onServerTick
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@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);
}
}
示例7: onServerTick
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@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);
}
}
示例8: update
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@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);
}
}
示例9: update
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void update(ServerTickEvent evt) {
ListIterator<TimedAction> iter = deferedActions.listIterator();
while(iter.hasNext()) {
TimedAction action = iter.next();
if(action.performThisTick()) {
iter.remove();
}
}
}
示例10: serverTick
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SuppressWarnings("static-method")
@SideOnly(Side.SERVER)
@SubscribeEvent
public void serverTick(ServerTickEvent event) {
if (event.phase == Phase.START) {
sendAnalyticsActivityEvent();
}
}
示例11: onServerTick
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
/**
* For internal use only. Do not call.
*/
@SubscribeEvent
public void onServerTick(ServerTickEvent event) {
if (event.phase == Phase.END) {
runTasks(serverQueue);
}
}
示例12: onTick
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@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);
}
}
}
}
}
示例13: onTick
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(ServerTickEvent evt) {
if (evt.phase == Phase.END && !queue.isEmpty()) {
Runnable task = queue.poll();
if (task != null) {
task.run();
}
}
}
示例14: tickStartChecker
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
private void tickStartChecker(ServerTickEvent event) {
if (event.phase == Phase.START) {
tickStart();
}
}
示例15: onServerTick
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onServerTick(ServerTickEvent event) {
if (Framez.proxy.isGamePaused())
return;
for (World w : MinecraftServer.getServer().worldServers)
tick(w, event.phase);
}