split time into 3 categories

This commit is contained in:
Sen 2025-08-03 21:58:30 +02:00
parent 2f9e7ba728
commit 1d19cddcef
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
21 changed files with 362 additions and 167 deletions

View file

@ -177,6 +177,7 @@ import common.vars.Vars;
import common.world.Chunk;
import common.world.LightType;
import common.world.State;
import common.world.Weather;
import common.world.World;
/*
@ -285,7 +286,8 @@ public class Client implements IThreadListener {
private final class WorldClient extends World {
public WorldClient(Dimension dim) {
super(dim, true);
this.daytime = dim.getTimeOffset();
this.orbit = dim.getOrbit();
this.rotation = dim.getRotation();
this.calculateInitialSkylight();
this.calculateInitialWeather();
this.updatePhysics();
@ -1895,16 +1897,17 @@ public class Client implements IThreadListener {
+ chunk.getLight(LightType.BLOCK, pos) + " Blöcke, " + String.format(
"%.1f", this.entityRenderer.getSunBrightness(1.0f) * 15.0f) + " Welt), A: "
+ String.format("%.1f °", this.world.getCelestialAngle(1.0f)) + "\n" +
String.format("Zeit: %d T, R %d / %d T, U %d / %d T",
this.world.getDayTime(),
this.world.getDayTime() % this.world.dimension.getRotationalPeriod(),
String.format("Zeit: %s" + (this.world.dimension.hasRotation() ? ", R %d / %d T" : "") + (this.world.dimension.hasOrbit() ? ", U %d / %d T" : ""),
this.world.formatEpochSimple(),
this.world.getRotation(),
this.world.dimension.getRotationalPeriod(),
this.world.getDayTime() % this.world.dimension.getOrbitalPeriod(),
this.world.getOrbit(),
this.world.dimension.getOrbitalPeriod()
) + "\n" +
String.format("Laub: %s, T: %.2f K / %.2f °C, %s (R %.1f, %.1f)",
!this.world.dimension.hasSeasons() ? "*" : this.world.getLeavesType().getDisplayName(),
String.format("Laub: %s, T: %.2f K / %.2f °C, %s%s (R %.1f, %.1f)",
!this.world.dimension.hasSeasons() ? "*" : this.world.getLeavesType().getDisplay(),
this.world.getTemperatureK(pos), this.world.getTemperatureC(pos),
this.world.dimension.hasWeather() ? "" : "*", !this.world.dimension.hasWeather() && this.world.getWeather() == Weather.CLEAR ? "" :
this.world.getWeather().getDisplay(), this.world.getRainStrength(),
this.world.getDarkness()
) + "\n" +
@ -3468,9 +3471,13 @@ public class Client implements IThreadListener {
this.world.updatePhysics();
this.markReload();
if (Vars.dayCycle)
if (Vars.timeFlow > 0)
{
this.world.setDayTime(this.world.getDayTime() + (long)Vars.timeFlow);
if(this.world.dimension.hasOrbit())
this.world.setOrbit((this.world.getOrbit() + (long)Vars.timeFlow) % this.world.dimension.getOrbitalPeriod());
if(this.world.dimension.hasRotation())
this.world.setRotation((this.world.getRotation() + (long)Vars.timeFlow) % this.world.dimension.getRotationalPeriod());
this.world.dimension.setEpoch(this.world.dimension.getEpoch() + (long)Vars.timeFlow);
}
for (int i = 0; i < 10 && !this.spawnQueue.isEmpty(); ++i)

View file

@ -959,8 +959,10 @@ public class ClientPlayer implements IClientPlayer
public void handleTimeUpdate(SPacketTimeUpdate packetIn)
{
NetHandler.checkThread(packetIn, this, this.gm, this.world);
// this.gameController.theWorld.getWorldInfo().setTime(packetIn.getTotalWorldTime());
this.gm.world.setDayTime(packetIn.getWorldTime());
if(this.gm.world.dimension.hasOrbit())
this.gm.world.setOrbit(packetIn.getOrbit());
if(this.gm.world.dimension.hasRotation())
this.gm.world.setRotation(packetIn.getRotation());
this.gm.setTicked(packetIn.getServerinfo());
Items.navigator.setLocalTime(packetIn.getLocalTime());
}

View file

@ -1254,7 +1254,7 @@ public class RenderGlobal
float f15 = this.gm.entityRenderer.getStarBrightness(partialTicks) * f16;
if (f15 > 0.0F)
{
int stars = this.theWorld.dimension.getStarColor(this.theWorld.getDayTime());
int stars = this.theWorld.dimension.getStarColor(this.theWorld.getRotation());
if(stars == 0xffffffff) {
GlState.color(f15, f15, f15, f15);
}
@ -1281,7 +1281,7 @@ public class RenderGlobal
f15 = this.gm.entityRenderer.getDeepStarBrightness(partialTicks) * f16;
if (f15 > 0.0F)
{
int stars = this.theWorld.dimension.getDeepStarColor(this.theWorld.getDayTime());
int stars = this.theWorld.dimension.getDeepStarColor(this.theWorld.getRotation());
if(stars == 0xffffffff) {
GlState.color(f15, f15, f15, f15);
}