From 301c3ff57769a504be7c4aaf71ec591c6424c8c9 Mon Sep 17 00:00:00 2001 From: FDUTCH Date: Sun, 9 Mar 2025 23:00:21 +0100 Subject: [PATCH 1/2] advance tick for non overworld dimension worlds --- server/world/tick.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/world/tick.go b/server/world/tick.go index 9c025d807..a1baa04ae 100644 --- a/server/world/tick.go +++ b/server/world/tick.go @@ -49,8 +49,9 @@ func (t ticker) tick(tx *Tx) { w.set.Unlock() return } + w.set.CurrentTick++ + if w.advance { - w.set.CurrentTick++ if w.set.TimeCycle { w.set.Time++ } From 21fb24df0484a4ac55498a73e4ebc35bad41fe66 Mon Sep 17 00:00:00 2001 From: FDUTCH Date: Wed, 12 Mar 2025 19:43:56 +0100 Subject: [PATCH 2/2] fix tick advance issue --- server/world/conf.go | 1 + server/world/tick.go | 10 ++++++++-- server/world/world.go | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/server/world/conf.go b/server/world/conf.go index 3514b3a5c..44569721c 100644 --- a/server/world/conf.go +++ b/server/world/conf.go @@ -95,6 +95,7 @@ func (conf Config) New() *World { conf: conf, ra: conf.Dim.Range(), set: s, + tick: s.CurrentTick, } w.weather = weather{w: w} var h Handler = NopHandler{} diff --git a/server/world/tick.go b/server/world/tick.go index a1baa04ae..ed38457c4 100644 --- a/server/world/tick.go +++ b/server/world/tick.go @@ -49,18 +49,24 @@ func (t ticker) tick(tx *Tx) { w.set.Unlock() return } - w.set.CurrentTick++ + + var tick int64 if w.advance { + w.set.CurrentTick++ if w.set.TimeCycle { w.set.Time++ } if w.set.WeatherCycle { w.advanceWeather() } + tick = w.set.CurrentTick + } else { + w.tick++ + tick = w.tick } - rain, thunder, tick, tim := w.set.Raining, w.set.Thundering && w.set.Raining, w.set.CurrentTick, int(w.set.Time) + rain, thunder, tim := w.set.Raining, w.set.Thundering && w.set.Raining, int(w.set.Time) w.set.Unlock() if tick%20 == 0 { diff --git a/server/world/world.go b/server/world/world.go index 403d3c5ee..6f6cfa4ea 100644 --- a/server/world/world.go +++ b/server/world/world.go @@ -37,7 +37,9 @@ type World struct { o sync.Once - set *Settings + set *Settings + tick int64 + handler atomic.Pointer[Handler] weather