Skip to content

Commit

Permalink
refresher: ticked daytime
Browse files Browse the repository at this point in the history
ticked movement
slight chunk optimizaiton
broke pk compression
  • Loading branch information
oq-x committed Sep 18, 2024
1 parent 30b7f19 commit 4b1cf88
Show file tree
Hide file tree
Showing 140 changed files with 885 additions and 3,243 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ data.qfg
server-icon.png
/resources
/server/session/atomicSlice.go
/server/session/a_test.go
/server/session/a_test.go
/qnbt2
/qnbt2test.go
/main
2 changes: 1 addition & 1 deletion commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package commands
import "github.com/zeppelinmc/zeppelin/server/command"

var Commands = []command.Command{
mem, debug, tick,
mem, debug, tick, timecmd,
}
2 changes: 1 addition & 1 deletion commands/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var debug = command.Command{
Node: command.NewCommand("debug"),
Node: command.NewLiteral("debug"),
Aliases: []string{"f3"},
Namespace: "zeppelin",
Callback: func(ccc command.CommandCallContext) {
Expand Down
2 changes: 1 addition & 1 deletion commands/mem.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
var memStats runtime.MemStats

var mem = command.Command{
Node: command.NewCommand("mem"),
Node: command.NewLiteral("mem"),
Namespace: "zeppelin",
Callback: func(ccc command.CommandCallContext) {
runtime.ReadMemStats(&memStats)
Expand Down
2 changes: 1 addition & 1 deletion commands/tick.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var tick = command.Command{
Node: command.NewCommand("tick", command.NewCommand("info"), command.NewCommand("freeze"), command.NewCommand("unfreeze")),
Node: command.NewLiteral("tick", command.NewLiteral("info"), command.NewLiteral("freeze"), command.NewLiteral("unfreeze")),
Callback: func(ccc command.CommandCallContext) {
tickManager := ccc.Server.(*server.Server).TickManager
command := ccc.Arguments.Fallback(0, "info")
Expand Down
30 changes: 30 additions & 0 deletions commands/time.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package commands

import (
"strconv"

"github.com/zeppelinmc/zeppelin/protocol/text"
"github.com/zeppelinmc/zeppelin/server"
"github.com/zeppelinmc/zeppelin/server/command"
)

var timecmd = command.Command{
Node: command.NewLiteral("time" /*command.NewCommand("add", command.NewTimeArgument("time", 0)), command.NewCommand("set", command.NewTimeArgument("time", 0))*/),
Callback: func(ccc command.CommandCallContext) {
command := ccc.Arguments.At(0)
w := ccc.Server.(*server.Server).World

switch command {
case "set":
t := ccc.Arguments.At(1)
time, err := strconv.Atoi(t)
if t == "" || err != nil {
ccc.Reply(text.Sprint("Invalid time"))
return
}

a, _ := w.Time()
ccc.Executor.UpdateTime(a, int64(time))
}
},
}
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ require (
github.com/pierrec/lz4/v4 v4.1.21
)

require github.com/oq-x/unsafe2 v0.0.0-20240826185617-691f34b78bf1
require github.com/oq-x/unsafe2 v0.0.0-20240901191313-2b7bec1d9e3b

require (
github.com/4kills/go-zlib v1.2.0
github.com/aimjel/minecraft v0.0.0-20240907220502-e1fe5798908b
github.com/aquilax/go-perlin v1.1.0
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand Down
8 changes: 6 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
github.com/4kills/go-libdeflate/v2 v2.2.0 h1:2kdYT79I+k23LO6VLn9p0l1Og47EWWgKbC1n353zE30=
github.com/4kills/go-libdeflate/v2 v2.2.0/go.mod h1:hyouZv4OAhHaaMpYuejstUN0xOg8mA+yy75WE3Ty6SM=
github.com/4kills/go-zlib v1.2.0 h1:h/OjHfOi0ZGAhotXzFVJK7V97cKNsEqRJVmJo4e8H6A=
github.com/4kills/go-zlib v1.2.0/go.mod h1:ngBUonyN1YJBHSknfLPNtWokAjYhHsaZDio8yS+BqSo=
github.com/aimjel/minecraft v0.0.0-20240907220502-e1fe5798908b h1:P5dA2C10r7BqzbhXqjjx07+LBV1tcsioFJrogWBOOBY=
github.com/aimjel/minecraft v0.0.0-20240907220502-e1fe5798908b/go.mod h1:jb47g4nDw3J8JdA4WxQpDx25NoIZiyNCjFOtM1b3Urk=
github.com/aquilax/go-perlin v1.1.0 h1:Gg+3jQ24wT4Y5GI7TCRLmYarzUG0k+n/JATFqOimb7s=
github.com/aquilax/go-perlin v1.1.0/go.mod h1:z9Rl7EM4BZY0Ikp2fEN1I5mKSOJ26HQpk0O2TBdN2HE=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
Expand All @@ -11,8 +15,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/oq-x/unsafe2 v0.0.0-20240826185617-691f34b78bf1 h1:wf86Y+hhivCZUfAPdbmj8LxHkYIOfRSKYnK5kCMSdxo=
github.com/oq-x/unsafe2 v0.0.0-20240826185617-691f34b78bf1/go.mod h1:x0z103mg/p7DX2tk7+9ubWfXbh+ynkAtwRlEOVEbIkk=
github.com/oq-x/unsafe2 v0.0.0-20240901191313-2b7bec1d9e3b h1:ffDVPOtSkPRHwJxp34oBUxgxR8H4arPUSzQMwT3fZi8=
github.com/oq-x/unsafe2 v0.0.0-20240901191313-2b7bec1d9e3b/go.mod h1:x0z103mg/p7DX2tk7+9ubWfXbh+ynkAtwRlEOVEbIkk=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
156 changes: 0 additions & 156 deletions protocol/nbt/nbt_test.go

This file was deleted.

1 change: 1 addition & 0 deletions protocol/nbt/qnbt/decode.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// deprecated: :(
package qnbt

import (
Expand Down
119 changes: 0 additions & 119 deletions protocol/nbt/qnbt/qnbt_test.go

This file was deleted.

Binary file removed protocol/nbt/qnbt/testdata/chunk.nbt
Binary file not shown.
Binary file removed protocol/nbt/qnbt/testdata/cpu.prof
Binary file not shown.
Binary file removed protocol/nbt/qnbt/testdata/mem.prof
Binary file not shown.
Binary file removed protocol/nbt/testdata/bigTest.nbt
Binary file not shown.
Binary file removed protocol/nbt/testdata/chunk.nbt
Binary file not shown.
Loading

0 comments on commit 4b1cf88

Please sign in to comment.