本文整理汇总了Java中net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent类的典型用法代码示例。如果您正苦于以下问题:Java ServerTickEvent类的具体用法?Java ServerTickEvent怎么用?Java ServerTickEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerTickEvent类属于net.minecraftforge.fml.common.gameevent.TickEvent包,在下文中一共展示了ServerTickEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onServerTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onServerTick(ServerTickEvent event)
{
if (event.phase != Phase.END) { return; } // Only doing it once
if (event.side == Side.CLIENT) { return; }
dayTick += 1; // Ticking up
if (dayTick >= Main.getControlRefreshTick()) // A day has passed. Refreshing faction chunk health now
{
TerritoryHandler.refreshChunkControl();
dayTick = 0; // Reset
}
saveTick += 1;
if (saveTick >= Main.getSaveTick()) // Autosave
{
SaveHandler.saveFactionsToFile();
saveTick = 0; // Reset
}
}
示例2: onServerTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onServerTick(ServerTickEvent event)
{
if (event.phase != Phase.END) { return; } // Only doing it once
if (event.side == Side.CLIENT) { return; }
// Chunk upkeep
if (Main.shouldCheckUpkeep())
{
TerritoryHandler.checkUpkeep();
}
// Chunk control regeneration
TerritoryHandler.checkChunkControl();
// Autosave
Main.checkAutoSave();
Main.checkDisplayTick();
}
示例3: onServerTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onServerTick(ServerTickEvent evt) {
if (!isEnabled() || evt.phase != Phase.START) {
return;
}
// server is ready now
if (!serverReady.get()) {
L.info("Server tick sync ready");
serverReady.set(true);
serverTick.set(0);
}
// wait for client side
if (!clientReady.get()) {
return;
}
// now sync with the client
waitFor(evt.side, serverTick, clientTick, serverAhead, clientAhead);
}
示例4: onServerTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onServerTick(ServerTickEvent event)
{
if (event.phase == TickEvent.Phase.END)
{
return;
}
// Once every second
if (++this.serverTickCounter >= 20)
{
this.serverTickCounter = 0;
ChunkLoading.getInstance().tickChunkTimeouts();
}
// This is currently only used for debug tasks, so let's disable it normally
//TaskScheduler.getInstance().runTasks();
this.teleportPlayers();
++this.playerTickCounter;
}
示例5: onTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(ServerTickEvent event) {
if (event.phase == Phase.START) {
SessionManager.getInstance().getAllSessions().forEachRemaining(sess -> {
sess.taskManager.runTasks();
});
}
}
示例6: serverTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void serverTick(ServerTickEvent event) {
if (event.phase == Phase.START) {
WirelessBolt.update(WirelessBolt.serverboltlist);
RedstoneEtherAddons.server().processTrackers();
} else {
RedstoneEtherAddons.server().tickTriangs();
RedstoneEtherAddons.server().updateREPTimeouts();
}
}
示例7: onServerTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@Override
protected void onServerTick(ServerTickEvent ev)
{
if (this.worldCreated && !this.serverStarted)
{
// The server has started ticking - we can set up its state machine,
// and move on to the next state in our own machine.
this.serverStarted = true;
MalmoMod.instance.initIntegratedServer(currentMissionInit()); // Needs to be done from the server thread.
episodeHasCompleted(ClientState.WAITING_FOR_SERVER_READY);
}
}
示例8: onServerTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@Override
protected void onServerTick(TickEvent.ServerTickEvent ev)
{
try
{
checkForMissionCommand();
}
catch (Exception e)
{
// TODO: What now?
e.printStackTrace();
}
}
示例9: onServerTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onServerTick(ServerTickEvent e)
{
if(counter == 1)
{
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
World world = server.getEntityWorld();
if(world.isRemote == false)
{
long totalTime = world.getWorldTime();
long currentTime = totalTime % 24000;
if(currentTime == 1)
{
System.out.println("Time is 0");
WorldTurn turn = WorldTurn.get(world);
int currentTurn = turn.advanceTurn();
System.out.println("New Turn!! The World Turn is now " + currentTurn);
ArrayList<EntityPlayerMP> playerList = (ArrayList<EntityPlayerMP>)(world.getMinecraftServer().getServer().getPlayerList().getPlayers());
for(int i=0; i < playerList.size(); i++)
{
EntityPlayer player = playerList.get(i);
ITurn playerTurn = player.getCapability(CapPlayerTurn.TURN_CAP, null);
playerTurn.addTurn();
}
}
}
counter = 0;
}
else
{
counter++;
}
}
示例10: onWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
/**
* Event listener for world tick event.
*
* This is probably not the optimal solution, but I'm not really sure how
* to schedule things in Minecraft other way than timers and ticks.
*
* This method is responsible for scheduling record unloading and counting
* down recording process.
*/
@SubscribeEvent
public void onWorldTick(ServerTickEvent event)
{
if (!CommonProxy.manager.records.isEmpty() && Blockbuster.proxy.config.record_unload)
{
this.checkAndUnloadRecords();
}
if (!CommonProxy.manager.scheduled.isEmpty())
{
this.checkScheduled();
}
}
示例11: tickServer
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void tickServer(ServerTickEvent event) {
if (event.phase == Phase.START && event.type == net.minecraftforge.fml.common.gameevent.TickEvent.Type.SERVER) {
PlayerHandler.update(Phase.START);
} else if (event.phase == Phase.END && event.type == net.minecraftforge.fml.common.gameevent.TickEvent.Type.SERVER) {
PlayerHandler.update(Phase.END);
}
}
示例12: onServerTick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGH)
public static void onServerTick(ServerTickEvent event) {
String flag = "20";
if (!System.getProperty("index.alchemy.runtime.debug.server", "").equals(flag)) {
// runtime do some thing
{
//System.out.println(EventHelper.getAllHandler(PlayerDropsEvent.class, 0));
}
System.setProperty("index.alchemy.runtime.debug.server", flag);
}
onRunnableTick(event.side, event.phase);
}
示例13: tickCellSaving
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@EventHandler
public void tickCellSaving(ServerTickEvent event) {
if (event.phase != Phase.END) return;
if (ticks++ < 5*20) return;
ticks = 0;
saveCellAllocations();
}
示例14: updateRecuringNotifications
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void updateRecuringNotifications(ServerTickEvent event) {
if (event.phase != Phase.END) return;
synchronized (recuring_notifications) {
Iterator<Notice> iterator = recuring_notifications.iterator();
while (iterator.hasNext()) {
Notice rn = iterator.next();
if (rn.isInvalid() || !rn.updateNotice()) {
iterator.remove();
}
}
}
}
示例15: tick
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void tick(ServerTickEvent event) {
if (event.phase == Phase.START) {
TileEntityWrathLamp.handleAirUpdates();
} else {
worldgenManager.tickRetrogenQueue();
}
}