Skip to content

advance tick for non overworld worlds #1029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions server/world/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
9 changes: 8 additions & 1 deletion server/world/tick.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func (t ticker) tick(tx *Tx) {
w.set.Unlock()
return
}

var tick int64

if w.advance {
w.set.CurrentTick++
if w.set.TimeCycle {
Expand All @@ -57,9 +60,13 @@ func (t ticker) tick(tx *Tx) {
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 {
Expand Down
4 changes: 3 additions & 1 deletion server/world/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ type World struct {

o sync.Once

set *Settings
set *Settings
tick int64

handler atomic.Pointer[Handler]

weather
Expand Down
Loading