use of org.lanternpowered.server.data.world.MoonPhase in project LanternServer by LanternPowered.
the class TimeUniverse method pulse.
void pulse() {
this.timeData.setAge(this.timeData.getAge() + 1);
final boolean doDaylightCycle = this.world.getOrCreateRule(RuleTypes.DO_DAYLIGHT_CYCLE).getValue();
long time = this.timeData.getDayTime();
if (doDaylightCycle) {
time++;
this.timeData.setDayTime(time);
}
final MoonPhase moonPhase = this.timeData.getMoonPhase();
if (this.syncCounter-- < 0 || this.lastDoDaylightCycle != doDaylightCycle || this.lastMoonPhase != moonPhase) {
this.syncCounter = SYNC_DELAY;
this.lastDoDaylightCycle = doDaylightCycle;
this.lastMoonPhase = moonPhase;
final long time1 = time;
this.world.broadcast(() -> new MessagePlayOutWorldTime(moonPhase, this.timeData.getAge(), (int) time1, doDaylightCycle));
}
}
Aggregations