Search in sources :

Example 1 with MessageServerTickTime

use of com.bluepowermod.network.message.MessageServerTickTime in project BluePower by Qmunity.

the class BPEventHandler method tick.

@SubscribeEvent
public void tick(TickEvent.WorldTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        if (event.world.getWorldTime() % 200 == 0) {
            //In case world are going to get their own thread: MinecraftServer.getServer().worldTickTimes.get(event.world.provider.dimensionId)
            double tickTime = MathHelper.mean(MinecraftServer.getServer().tickTimeArray) * 1.0E-6D;
            BPNetworkHandler.INSTANCE.sendToDimension(new MessageServerTickTime(tickTime), event.world.provider.dimensionId);
        }
    }
}
Also used : MessageServerTickTime(com.bluepowermod.network.message.MessageServerTickTime) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Aggregations

MessageServerTickTime (com.bluepowermod.network.message.MessageServerTickTime)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1