diff --git a/.gitignore b/.gitignore index 647d0a4c..8bdfcbff 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,7 @@ data.qfg server-icon.png /resources /server/session/atomicSlice.go -/server/session/a_test.go \ No newline at end of file +/server/session/a_test.go +/qnbt2 +/qnbt2test.go +/main \ No newline at end of file diff --git a/commands/commands.go b/commands/commands.go index c5c19ca0..07fcd6aa 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -3,5 +3,5 @@ package commands import "github.com/zeppelinmc/zeppelin/server/command" var Commands = []command.Command{ - mem, debug, tick, + mem, debug, tick, timecmd, } diff --git a/commands/debug.go b/commands/debug.go index 2ddd0fb9..da5526e7 100644 --- a/commands/debug.go +++ b/commands/debug.go @@ -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) { diff --git a/commands/mem.go b/commands/mem.go index eb6698fd..d2351324 100644 --- a/commands/mem.go +++ b/commands/mem.go @@ -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) diff --git a/commands/tick.go b/commands/tick.go index 3a6cff1a..aa5ab741 100644 --- a/commands/tick.go +++ b/commands/tick.go @@ -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") diff --git a/commands/time.go b/commands/time.go new file mode 100644 index 00000000..6f7901b4 --- /dev/null +++ b/commands/time.go @@ -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)) + } + }, +} diff --git a/go.mod b/go.mod index 9bfe96fa..236d4599 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index b9a2a4a4..10be1881 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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= diff --git a/protocol/nbt/nbt_test.go b/protocol/nbt/nbt_test.go deleted file mode 100644 index 694633bb..00000000 --- a/protocol/nbt/nbt_test.go +++ /dev/null @@ -1,156 +0,0 @@ -package nbt - -import ( - "bytes" - _ "embed" - "fmt" - "os" - "testing" -) - -//go:embed testdata/bigTest.nbt -var bigTestData []byte - -//go:embed testdata/chunk.nbt -var chunkData []byte - -type bigTest struct { - Level struct { - LongTest int64 `nbt:"longTest"` - ShortTest int16 `nbt:"shortTest"` - StringTest string `nbt:"stringTest"` - FloatTest float32 `nbt:"floatTest"` - IntTest int32 `nbt:"intTest"` - NestedCompoundTest struct { - Ham struct { - Name string `nbt:"name"` - Value float32 `nbt:"value"` - } `nbt:"ham"` - Egg struct { - Name string `nbt:"name"` - Value float32 `nbt:"value"` - } `nbt:"egg"` - } `nbt:"nested compound test"` - - ListTestLong []int64 `nbt:"listTest (long)"` - - ListTestCompound []struct { - Name string `nbt:"name"` - CreatedOn int64 `nbt:"created-on"` - } `nbt:"listTest (compound)"` - - ByteTest int8 `nbt:"byteTest"` - - DoubleTest float64 `nbt:"doubleTest"` - } -} - -type chunk struct { - Status string - ZPos int32 `nbt:"zPos"` - LastUpdate int64 - InhabitedTime int64 - XPos int32 `nbt:"xPos"` - Heightmaps struct { - OceanFloor []int64 `nbt:"OCEAN_FLOOR"` - MotionBlockingNoLeaves []int64 `nbt:"MOTION_BLOCKING_NO_LEAVES"` - MotionBlocking []int64 `nbt:"MOTION_BLOCKING"` - WorldSurface []int64 `nbt:"WORLD_SURFACE"` - } - IsLightOn int8 `nbt:"isLightOn"` - Sections []struct { - Y int8 - BlockStates struct { - Data []int64 `nbt:"data"` - Palette []struct { - Name string - Properties map[string]string - } `nbt:"palette"` - } `nbt:"block_states"` - } `nbt:"sections"` - - DataVersion int32 -} - -func TestUnmarshalChunk(t *testing.T) { - var c chunk - if _, err := Unmarshal(chunkData, &c); err != nil { - t.Fatal(err) - } - fmt.Println(c) -} - -func TestDecoder_Decode(t *testing.T) { - var c chunk - if _, err := NewDecoder(bytes.NewReader(chunkData)).Decode(&c); err != nil { - t.Fatal(err) - } - -} - -func TestUnmarshalBigTest(t *testing.T) { - var bg bigTest - if _, err := Unmarshal(bigTestData, &bg); err != nil { - t.Fatal(err) - } - t.Logf("%+v\n", bg) -} - -func BenchmarkUnmarshalChunk(b *testing.B) { - var c chunk - for i := 0; i < b.N; i++ { - Unmarshal(chunkData, &c) - } - b.ReportAllocs() -} - -func BenchmarkDecoder_DecodeChunk(b *testing.B) { - var c chunk - rd := bytes.NewReader(chunkData) - dec := NewDecoder(rd) - b.ResetTimer() - - for i := 0; i < b.N; i++ { - dec.Decode(&c) - - b.StopTimer() - rd.Reset(chunkData) - b.StartTimer() - } - b.ReportAllocs() -} - -func BenchmarkUnmarshalBigTest(b *testing.B) { - var bgTest bigTest - for i := 0; i < b.N; i++ { - Unmarshal(bigTestData, &bgTest) - } - b.ReportAllocs() -} - -func TestEncoder(t *testing.T) { - var ck chunk - _, _ = Unmarshal(chunkData, &ck) - - var buf bytes.Buffer - if err := NewEncoder(&buf).Encode("", ck); err != nil { - t.Fatal(err) - } - - _ = os.WriteFile("test.nbt", buf.Bytes(), 0666) -} - -func BenchmarkEncoder(b *testing.B) { - var c chunk - _, _ = Unmarshal(chunkData, &c) - - buf := bytes.NewBuffer(make([]byte, 0, len(chunkData))) - enc := NewEncoder(buf) - b.ResetTimer() - for i := 0; i < b.N; i++ { - _ = enc.Encode("", c) - buf.Reset() - } - - b.ReportAllocs() -} diff --git a/protocol/nbt/qnbt/decode.go b/protocol/nbt/qnbt/decode.go index e455e59b..00205e3a 100644 --- a/protocol/nbt/qnbt/decode.go +++ b/protocol/nbt/qnbt/decode.go @@ -1,3 +1,4 @@ +// deprecated: :( package qnbt import ( diff --git a/protocol/nbt/qnbt/qnbt_test.go b/protocol/nbt/qnbt/qnbt_test.go deleted file mode 100644 index dc46f5ab..00000000 --- a/protocol/nbt/qnbt/qnbt_test.go +++ /dev/null @@ -1,119 +0,0 @@ -package qnbt - -import ( - _ "embed" - "os" - "runtime/pprof" - "testing" -) - -//go:embed testdata/chunk.nbt -var chunkData []byte - -type chunk struct { - Status string - ZPos int32 `nbt:"zPos"` - LastUpdate int64 - InhabitedTime int64 - XPos int32 `nbt:"xPos"` - YPos int32 `nbt:"yPos"` - Heightmaps struct { - OceanFloor []int64 `nbt:"OCEAN_FLOOR"` - MotionBlockingNoLeaves []int64 `nbt:"MOTION_BLOCKING_NO_LEAVES"` - MotionBlocking []int64 `nbt:"MOTION_BLOCKING"` - WorldSurface []int64 `nbt:"WORLD_SURFACE"` - } - BlockEntities []struct { - Id string `nbt:"id"` - KeepPacked bool `nbt:"keepPacked"` - Normal struct { - SimultaneousMobs float32 `nbt:"simultaneous_mobs"` - SimultaneousMobsAddedPerPlayer float32 `nbt:"simultaneous_mobs_added_per_player"` - SpawnPotentials []struct { - Data struct { - Entity struct { - Id string `nbt:"id"` - } `nbt:"entity"` - } `nbt:"data"` - Weight int32 `nbt:"weight"` - } `nbt:"spawn_potentials"` - TicksBetweenSpawn int32 `nbt:"ticks_between_spawn"` - } `nbt:"normal_config"` - Ominous struct { - Loot []struct { - Data string `nbt:"data"` - Weight int32 `nbt:"weight"` - } `nbt:"loot_tables_to_eject"` - - SimultaneousMobs float32 `nbt:"simultaneous_mobs"` - SimultaneousMobsAddedPerPlayer float32 `nbt:"simultaneous_mobs_added_per_player"` - TicksBetweenSpawn int32 `nbt:"ticks_between_spawn"` - - SpawnPotentials []struct { - Data struct { - Entity struct { - Id string `nbt:"id"` - } `nbt:"entity"` - Equipment struct { - LootTable string `nbt:"loot_table"` - SlotDropChances float32 `nbt:"slot_drop_chances"` - } `nbt:"equipment"` - } `nbt:"data"` - Weight int32 `nbt:"weight"` - } `nbt:"spawn_potentials"` - } `nbt:"ominous_config"` - X int32 `nbt:"x"` - Y int32 `nbt:"y"` - Z int32 `nbt:"z"` - } `nbt:"block_entities"` - BlockTicks []struct { - I string `nbt:"i"` - P int32 `nbt:"p"` - T int32 `nbt:"t"` - X int32 `nbt:"x"` - Y int32 `nbt:"y"` - Z int32 `nbt:"z"` - } `nbt:"block_ticks"` - PostProcessing [][]int16 - IsLightOn int8 `nbt:"isLightOn"` - Sections []struct { - Y int8 - BlockLight, SkyLight []byte - Biomes struct { - Data []int64 `nbt:"data"` - Palette []string `nbt:"palette"` - } `nbt:"biomes"` - BlockStates struct { - Data []int64 `nbt:"data"` - Palette []struct { - Name string - Properties map[string]string - } `nbt:"palette"` - } `nbt:"block_states"` - } `nbt:"sections"` - - Structures struct { - References struct { - Tc []int64 `nbt:"minecraft:trial_chambers"` - } - Starts struct{} `nbt:"starts"` - } `nbt:"structures"` - - DataVersion int32 -} - -func BenchmarkXxx(b *testing.B) { - f1, _ := os.Create("testdata/cpu.prof") - pprof.StartCPUProfile(f1) - - for i := 0; i < b.N; i++ { - Unmarshal(chunkData, &chunk{}) - } - b.ReportAllocs() - f, _ := os.Create("testdata/mem.prof") - pprof.Lookup("allocs").WriteTo(f, 0) - f.Close() - - pprof.StopCPUProfile() - f1.Close() -} diff --git a/protocol/nbt/qnbt/testdata/chunk.nbt b/protocol/nbt/qnbt/testdata/chunk.nbt deleted file mode 100644 index af55fcde..00000000 Binary files a/protocol/nbt/qnbt/testdata/chunk.nbt and /dev/null differ diff --git a/protocol/nbt/qnbt/testdata/cpu.prof b/protocol/nbt/qnbt/testdata/cpu.prof deleted file mode 100644 index a3fa826d..00000000 Binary files a/protocol/nbt/qnbt/testdata/cpu.prof and /dev/null differ diff --git a/protocol/nbt/qnbt/testdata/mem.prof b/protocol/nbt/qnbt/testdata/mem.prof deleted file mode 100644 index 27e9d63c..00000000 Binary files a/protocol/nbt/qnbt/testdata/mem.prof and /dev/null differ diff --git a/protocol/nbt/testdata/bigTest.nbt b/protocol/nbt/testdata/bigTest.nbt deleted file mode 100644 index acf627be..00000000 Binary files a/protocol/nbt/testdata/bigTest.nbt and /dev/null differ diff --git a/protocol/nbt/testdata/chunk.nbt b/protocol/nbt/testdata/chunk.nbt deleted file mode 100644 index f36b6d02..00000000 Binary files a/protocol/nbt/testdata/chunk.nbt and /dev/null differ diff --git a/protocol/nbt/testdata/uncompress.go b/protocol/nbt/testdata/uncompress.go deleted file mode 100644 index 052a483d..00000000 --- a/protocol/nbt/testdata/uncompress.go +++ /dev/null @@ -1,31 +0,0 @@ -package main - -import ( - "bytes" - "compress/gzip" - _ "embed" - "io" - "os" -) - -//go:embed bigTest.nbt -var bigTest []byte - -func main() { - gr, err := gzip.NewReader(bytes.NewReader(bigTest)) - if err != nil { - panic(err) - } - - out := make([]byte, 1024) - - n, err := gr.Read(out) - if err != nil && err != io.EOF { - panic(err) - } - - err = os.WriteFile("bigTest.nbt", out[:n], 0666) - if err != nil { - panic(err) - } -} diff --git a/protocol/net/conn.go b/protocol/net/conn.go index 39a5261b..df9df1c5 100644 --- a/protocol/net/conn.go +++ b/protocol/net/conn.go @@ -5,15 +5,16 @@ import ( "crypto/md5" "encoding/binary" "fmt" + "io" "net" "sync" "sync/atomic" "unicode/utf16" + "github.com/4kills/go-zlib" "github.com/zeppelinmc/zeppelin/protocol/net/cfb8" - "github.com/zeppelinmc/zeppelin/protocol/net/io" "github.com/zeppelinmc/zeppelin/protocol/net/io/compress" - "github.com/zeppelinmc/zeppelin/protocol/net/io/util" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/packet" "github.com/zeppelinmc/zeppelin/protocol/net/packet/handshake" "github.com/zeppelinmc/zeppelin/protocol/net/packet/login" @@ -80,33 +81,38 @@ func (conn *Conn) State() int32 { return conn.state.Load() } -var pkbufpool = sync.Pool{ +var pkpool = sync.Pool{ New: func() any { return bytes.NewBuffer(nil) }, } -var pkpool = sync.Pool{ +var pkcppool = sync.Pool{ New: func() any { return bytes.NewBuffer(nil) }, } func (conn *Conn) WritePacket(pk packet.Encodeable) error { + conn.write_mu.Lock() //TODO: fix concurrent ticking with encryption! + defer conn.write_mu.Unlock() if PacketEncodeInterceptor != nil { if PacketEncodeInterceptor(conn, pk) { return nil } } - conn.write_mu.Lock() - defer conn.write_mu.Unlock() - var packetBuf = pkpool.Get().(*bytes.Buffer) packetBuf.Reset() defer pkpool.Put(packetBuf) - w := io.NewWriter(packetBuf) + w := encoding.NewWriter(packetBuf) + // write the header for the packet + if conn.listener.cfg.CompressionThreshold < 0 || !conn.compressionSet { + packetBuf.Write([]byte{0x80, 0x80, 0}) + } else if conn.compressionSet { + packetBuf.Write([]byte{0x80, 0x80, 0, 0x80, 0x80, 0}) + } if err := w.VarInt(pk.ID()); err != nil { return err @@ -122,52 +128,50 @@ func (conn *Conn) WritePacket(pk packet.Encodeable) error { } if conn.listener.cfg.CompressionThreshold < 0 || !conn.compressionSet { // no compression - if err := io.WriteVarInt(conn, int32(packetBuf.Len())); err != nil { - return err + i := encoding.PutVarInt(packetBuf.Bytes()[:3], int32(packetBuf.Len()-3)) + if i != 2 { + packetBuf.Bytes()[i] |= 0x80 } + _, err := packetBuf.WriteTo(conn) return err } else { // yes compression - if conn.listener.cfg.CompressionThreshold > int32(packetBuf.Len()) { // packet is too small to be compressed - var buf = pkpool.Get().(*bytes.Buffer) - buf.Reset() - defer pkpool.Put(buf) - - if err := io.WriteVarInt(buf, int32(packetBuf.Len()+1)); err != nil { - return err - } - if err := io.WriteVarInt(buf, 0); err != nil { - return err - } - if _, err := packetBuf.WriteTo(buf); err != nil { - return err + if conn.listener.cfg.CompressionThreshold > int32(packetBuf.Len())-6 { // packet is too small to be compressed + i := encoding.PutVarInt(packetBuf.Bytes()[:3], int32(packetBuf.Len()-6)) + if i != 2 { + packetBuf.Bytes()[i] |= 0x80 } - _, err := buf.WriteTo(conn) + _, err := packetBuf.WriteTo(conn) return err } else { // packet is compressed - var buf = pkpool.Get().(*bytes.Buffer) - buf.Reset() - defer pkpool.Put(buf) + uncompressedLength := int32(packetBuf.Len() - 6) + if i := encoding.PutVarInt(packetBuf.Bytes()[3:6], uncompressedLength); i != 2 { + packetBuf.Bytes()[i+3] |= 0x80 + } - dataLength := io.AppendVarInt(nil, int32(packetBuf.Len())) + z := compress.WZlib.Get().(*zlib.Writer) + defer compress.WZlib.Put(z) - compressedPacket, err := compress.CompressZlib(packetBuf.Bytes(), &MaxCompressedPacketSize) - if err != nil { - return err - } + c := pkcppool.Get().(*bytes.Buffer) + c.Reset() + defer pkcppool.Put(c) - if err := io.WriteVarInt(buf, int32(len(compressedPacket)+len(dataLength))); err != nil { - return err - } - if _, err := buf.Write(dataLength); err != nil { - return err + z.Reset(c) + z.Write(packetBuf.Bytes()[6:]) + z.Flush() + + compressedLength := c.Len() + 3 + + if i := encoding.PutVarInt(packetBuf.Bytes()[:3], int32(compressedLength)); i != 2 { + packetBuf.Bytes()[i] |= 0x80 } - if _, err := buf.Write(compressedPacket); err != nil { + + if _, err := conn.Write(packetBuf.Bytes()[:6]); err != nil { return err } + _, err := conn.Write(c.Bytes()) - _, err = buf.WriteTo(conn) return err } } @@ -201,7 +205,7 @@ func (conn *Conn) ReadPacket() (packet.Decodeable, error) { conn.read_mu.Lock() defer conn.read_mu.Unlock() - var rd = io.NewReader(conn, 0) + var rd = encoding.NewReader(conn, 0) var ( length, packetId int32 ) @@ -220,7 +224,7 @@ func (conn *Conn) ReadPacket() (packet.Decodeable, error) { if _, err := conn.Read(packet); err != nil { return nil, err } - id, data, err := io.VarInt(packet) + id, data, err := encoding.VarInt(packet) if err != nil { return nil, err } @@ -228,7 +232,7 @@ func (conn *Conn) ReadPacket() (packet.Decodeable, error) { packet = data length = int32(len(data)) - rd = io.NewReader(bytes.NewReader(packet), int(length)) + rd = encoding.NewReader(bytes.NewReader(packet), int(length)) } else { var packetLength int32 if _, err := rd.VarInt(&packetLength); err != nil { @@ -256,7 +260,7 @@ func (conn *Conn) ReadPacket() (packet.Decodeable, error) { return nil, err } - id, data, err := io.VarInt(packet) + id, data, err := encoding.VarInt(packet) if err != nil { return nil, err } @@ -272,7 +276,7 @@ func (conn *Conn) ReadPacket() (packet.Decodeable, error) { } } - rd = io.NewReader(r, int(length)) + rd = encoding.NewReader(r, int(length)) } } else { //packet is compressed length = dataLength @@ -282,7 +286,7 @@ func (conn *Conn) ReadPacket() (packet.Decodeable, error) { var packetBuf = pkpool.Get().(*bytes.Buffer) packetBuf.Reset() - packetBuf.ReadFrom(util.NewReaderMaxxer(conn, int(compressedLength))) + packetBuf.ReadFrom(io.LimitReader(conn, int64(compressedLength))) defer pkpool.Put(packetBuf) uncompressedPacket, err := compress.DecompressZlib(packetBuf.Bytes(), &ilength) @@ -290,7 +294,7 @@ func (conn *Conn) ReadPacket() (packet.Decodeable, error) { return nil, err } - id, data, err := io.VarInt(uncompressedPacket) + id, data, err := encoding.VarInt(uncompressedPacket) if err != nil { return nil, err } @@ -306,7 +310,7 @@ func (conn *Conn) ReadPacket() (packet.Decodeable, error) { } } - rd = io.NewReader(r, int(length)) + rd = encoding.NewReader(r, int(length)) } } diff --git a/protocol/net/io/buffers/buffers.go b/protocol/net/io/buffers/buffers.go index 7423e37b..107d5e8d 100644 --- a/protocol/net/io/buffers/buffers.go +++ b/protocol/net/io/buffers/buffers.go @@ -7,7 +7,7 @@ import ( var Buffers = sync.Pool{ New: func() any { - return bytes.NewBuffer(nil) + return new(bytes.Buffer) }, } @@ -15,7 +15,7 @@ func Size() int { buf := Buffers.Get().(*bytes.Buffer) defer Buffers.Put(buf) - return buf.Len() + return buf.Cap() } func Reset() { diff --git a/protocol/net/io/compress/compress.go b/protocol/net/io/compress/compress.go index a89335e6..994cb27e 100644 --- a/protocol/net/io/compress/compress.go +++ b/protocol/net/io/compress/compress.go @@ -2,12 +2,14 @@ package compress import ( "bytes" + "compress/gzip" "sync" "github.com/4kills/go-libdeflate/v2" + "github.com/4kills/go-zlib" ) -var decompressors = sync.Pool{ +var Decompressors = sync.Pool{ New: func() any { dc, _ := libdeflate.NewDecompressor() return dc @@ -24,3 +26,23 @@ var compressors = sync.Pool{ var bufs = sync.Pool{ New: func() any { return new(bytes.Buffer) }, } + +// RZlib is a pool of zlib.Reader's that can be reused to avoid allocations +var RZlib = sync.Pool{ + New: func() any { d, _ := zlib.NewReader(nil); return d }, +} + +// RGzip is a pool of gzip.Reader's that can be reused to avoid allocations +var RGzip = sync.Pool{ + New: func() any { d, _ := gzip.NewReader(nil); return d }, +} + +// WZlib is a pool of zlib.Writer's that can be reused to avoid allocations +var WZlib = sync.Pool{ + New: func() any { return zlib.NewWriter(nil) }, +} + +// WGzip is a pool of gzip.Writer's that can be reused to avoid allocations +var WGzip = sync.Pool{ + New: func() any { return gzip.NewWriter(nil) }, +} diff --git a/protocol/net/io/compress/gzip.go b/protocol/net/io/compress/gzip.go deleted file mode 100644 index 6a76eb1b..00000000 --- a/protocol/net/io/compress/gzip.go +++ /dev/null @@ -1,49 +0,0 @@ -package compress - -import ( - "github.com/4kills/go-libdeflate/v2" -) - -// Decompress gunzip. The data returned is only safe to use until the next operation -func DecompressGzip(compressed []byte, decompressedLength *int) ([]byte, error) { - dc := decompressors.Get().(libdeflate.Decompressor) - defer decompressors.Put(dc) - - if decompressedLength != nil { - dst := bufs.Get().([]byte) - if len(dst) < int(*decompressedLength) { - dst = make([]byte, *decompressedLength) - } - defer bufs.Put(dst) - - _, decompressedResult, err := dc.Decompress(compressed, dst[:*decompressedLength], libdeflate.ModeGzip) - - return decompressedResult, err - } else { - _, decompressedResult, err := dc.Decompress(compressed, nil, libdeflate.ModeGzip) - return decompressedResult, err - } -} - -// Compresses gunzip. If compressedLength is provided, data returned will only be safe to use until the next operation. -// It is recommmended to provide the compressed length to avoid allocation. If you don't know it, provide a number likely bigger than the compressed length. -func CompressGzip(decompressedData []byte, compressedLength *int) (compressed []byte, err error) { - c := compressors.Get().(libdeflate.Compressor) - defer compressors.Put(c) - - if compressedLength != nil { - dst := bufs.Get().([]byte) - if len(dst) < int(*compressedLength) { - dst = make([]byte, *compressedLength) - } - defer bufs.Put(dst) - - _, compressedResult, err := c.Compress(decompressedData, dst[:*compressedLength], libdeflate.ModeGzip) - - return compressedResult, err - } else { - _, compressedResult, err := c.Compress(decompressedData, nil, libdeflate.ModeGzip) - - return compressedResult, err - } -} diff --git a/protocol/net/io/compress/zlib.go b/protocol/net/io/compress/zlib.go index d8b5fba9..0d5ce826 100644 --- a/protocol/net/io/compress/zlib.go +++ b/protocol/net/io/compress/zlib.go @@ -9,8 +9,8 @@ import ( // Decompress zlib. If decompressedLength is provided, the data returned will only be safe to use until the next operation // It is recommmended to provide the decompressed length to avoid allocation. If you don't know it, provide a number likely bigger than the decompressed length. func DecompressZlib(compressed []byte, decompressedLength *int) ([]byte, error) { - dc := decompressors.Get().(libdeflate.Decompressor) - defer decompressors.Put(dc) + dc := Decompressors.Get().(libdeflate.Decompressor) + defer Decompressors.Put(dc) if decompressedLength != nil { dst := bufs.Get().(*bytes.Buffer) diff --git a/protocol/net/io/io.go b/protocol/net/io/encoding/encoding.go similarity index 91% rename from protocol/net/io/io.go rename to protocol/net/io/encoding/encoding.go index 29e21715..aa25cbe6 100644 --- a/protocol/net/io/io.go +++ b/protocol/net/io/encoding/encoding.go @@ -1,4 +1,5 @@ -package io +// Package encoding provides encoding and decoding of minecraft data types +package encoding import ( "fmt" @@ -39,6 +40,18 @@ func AppendVarInt(data []byte, value int32) []byte { return append(data, byte(ux)) } +func PutVarInt(data []byte, value int32) (n int) { + ux := uint32(value) + var i int + for ; ux >= 0x80; i++ { + data[i] = byte(ux&0x7F) | 0x80 + ux >>= 7 + } + data[i] = byte(ux) + + return i +} + func WriteVarInt(w io.Writer, value int32) error { ux := uint32(value) for ux >= 0x80 { diff --git a/protocol/net/io/reader.go b/protocol/net/io/encoding/reader.go similarity index 99% rename from protocol/net/io/reader.go rename to protocol/net/io/encoding/reader.go index 6b2598ab..8908f0a4 100644 --- a/protocol/net/io/reader.go +++ b/protocol/net/io/encoding/reader.go @@ -1,4 +1,4 @@ -package io +package encoding import ( "encoding/json" diff --git a/protocol/net/io/writer.go b/protocol/net/io/encoding/writer.go similarity index 99% rename from protocol/net/io/writer.go rename to protocol/net/io/encoding/writer.go index 58b820c5..39390362 100644 --- a/protocol/net/io/writer.go +++ b/protocol/net/io/encoding/writer.go @@ -1,4 +1,4 @@ -package io +package encoding import ( "bytes" diff --git a/protocol/net/io/util/flusher.go b/protocol/net/io/util/flusher.go deleted file mode 100644 index 17701581..00000000 --- a/protocol/net/io/util/flusher.go +++ /dev/null @@ -1,35 +0,0 @@ -package util - -import ( - "bytes" - "io" -) - -func NewFlusher(w io.WriteCloser, buf *bytes.Buffer) *Flusher { - f := &Flusher{w: w} - if buf != nil { - f.buf = *buf - } - - return f -} - -type Flusher struct { - w io.WriteCloser - - buf bytes.Buffer -} - -func (f *Flusher) Write(p []byte) (n int, err error) { - return f.buf.Write(p) -} - -// flush writes the buffer to w and closes it -func (f *Flusher) Flush() (n int64, err error) { - i, err := f.buf.WriteTo(f.w) - - if err != nil { - return i, err - } - return i, f.w.Close() -} diff --git a/protocol/net/io/util/readerAtMaxxer.go b/protocol/net/io/util/readerAtMaxxer.go deleted file mode 100644 index de5cb7cb..00000000 --- a/protocol/net/io/util/readerAtMaxxer.go +++ /dev/null @@ -1,35 +0,0 @@ -package util - -import ( - "io" -) - -func NewReaderAtMaxxer(r io.ReaderAt, max int, baseOffset int64) *ReaderAtMaxxer { - return &ReaderAtMaxxer{r: r, max: max, offset: baseOffset} -} - -// ReaderAtMaxxer takes a readerAt and only allows max bytes to be read from it -type ReaderAtMaxxer struct { - r io.ReaderAt - - max int - read int - - offset int64 -} - -func (r *ReaderAtMaxxer) Read(data []byte) (i int, err error) { - if r.read >= r.max { - return 0, io.EOF - } - - remaining := r.max - r.read - if len(data) > remaining { - data = data[:remaining] - } - - n, err := r.r.ReadAt(data, r.offset+int64(r.read)) - r.read += n - - return n, err -} diff --git a/protocol/net/io/util/readerAtReader.go b/protocol/net/io/util/readerAtReader.go deleted file mode 100644 index 4bebae53..00000000 --- a/protocol/net/io/util/readerAtReader.go +++ /dev/null @@ -1,23 +0,0 @@ -package util - -import "io" - -type ReaderAtReader struct { - r io.ReaderAt - - offset int64 -} - -// NewReaderAtReader makes a ReaderAtReader that starts reading at off -func NewReaderAtReader(r io.ReaderAt, off int64) *ReaderAtReader { - return &ReaderAtReader{r: r} -} - -func (r *ReaderAtReader) Read(p []byte) (n int, err error) { - n, err = r.r.ReadAt(p, r.offset) - if err == nil { - r.offset += int64(n) - } - - return n, err -} diff --git a/protocol/net/io/util/readerMaxxer.go b/protocol/net/io/util/readerMaxxer.go deleted file mode 100644 index 024530a4..00000000 --- a/protocol/net/io/util/readerMaxxer.go +++ /dev/null @@ -1,31 +0,0 @@ -package util - -import "io" - -func NewReaderMaxxer(r io.Reader, max int) *ReaderMaxxer { - return &ReaderMaxxer{r: r, max: max} -} - -// ReaderMaxxer takes a reader and only allows max bytes to be read from it -type ReaderMaxxer struct { - r io.Reader - - max int - read int -} - -func (r *ReaderMaxxer) Read(data []byte) (i int, err error) { - if r.read >= r.max { - return 0, io.EOF - } - - remaining := r.max - r.read - if len(data) > remaining { - data = data[:remaining] - } - - n, err := r.r.Read(data) - r.read += n - - return n, err -} diff --git a/protocol/net/io/util/util.go b/protocol/net/io/util/util.go deleted file mode 100644 index 5e1261e1..00000000 --- a/protocol/net/io/util/util.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package util provides some custom readers - -package util diff --git a/protocol/net/packet/configuration/clientInfo.go b/protocol/net/packet/configuration/clientInfo.go index b549b41d..8de94902 100644 --- a/protocol/net/packet/configuration/clientInfo.go +++ b/protocol/net/packet/configuration/clientInfo.go @@ -1,6 +1,8 @@ package configuration -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) const ( ChatModeEnabled = iota @@ -23,7 +25,7 @@ const ( MainHandRight ) -//serverbound +// serverbound const PacketIdClientInformation = 0x00 type ClientInformation struct { @@ -41,7 +43,7 @@ func (ClientInformation) ID() int32 { return 0x00 } -func (c *ClientInformation) Encode(w io.Writer) error { +func (c *ClientInformation) Encode(w encoding.Writer) error { if err := w.String(c.Locale); err != nil { return err } @@ -66,7 +68,7 @@ func (c *ClientInformation) Encode(w io.Writer) error { return w.Bool(c.AllowServerListing) } -func (c *ClientInformation) Decode(r io.Reader) error { +func (c *ClientInformation) Decode(r encoding.Reader) error { if err := r.String(&c.Locale); err != nil { return err } diff --git a/protocol/net/packet/configuration/disconnect.go b/protocol/net/packet/configuration/disconnect.go index 094599d6..bbcd4737 100644 --- a/protocol/net/packet/configuration/disconnect.go +++ b/protocol/net/packet/configuration/disconnect.go @@ -1,7 +1,7 @@ package configuration import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -16,10 +16,10 @@ func (Disconnect) ID() int32 { return 0x02 } -func (d *Disconnect) Encode(w io.Writer) error { +func (d *Disconnect) Encode(w encoding.Writer) error { return w.TextComponent(d.Reason) } -func (d *Disconnect) Decode(r io.Reader) error { +func (d *Disconnect) Decode(r encoding.Reader) error { return r.TextComponent(&d.Reason) } diff --git a/protocol/net/packet/configuration/keepAlive.go b/protocol/net/packet/configuration/keepAlive.go index 62c36489..5afb21d7 100644 --- a/protocol/net/packet/configuration/keepAlive.go +++ b/protocol/net/packet/configuration/keepAlive.go @@ -1,8 +1,10 @@ package configuration -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) -//two-sided +// two-sided const PacketIdKeepAlive = 0x04 type KeepAlive struct { @@ -13,10 +15,10 @@ func (KeepAlive) ID() int32 { return 0x04 } -func (k *KeepAlive) Encode(w io.Writer) error { +func (k *KeepAlive) Encode(w encoding.Writer) error { return w.Long(k.KeepAliveID) } -func (k *KeepAlive) Decode(r io.Reader) error { +func (k *KeepAlive) Decode(r encoding.Reader) error { return r.Long(&k.KeepAliveID) } diff --git a/protocol/net/packet/configuration/ping.go b/protocol/net/packet/configuration/ping.go index 7e890898..adc12757 100644 --- a/protocol/net/packet/configuration/ping.go +++ b/protocol/net/packet/configuration/ping.go @@ -1,8 +1,10 @@ package configuration -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) -//two-sided +// two-sided const PacketIdPing = 0x05 type Ping struct { @@ -13,11 +15,11 @@ func (Ping) ID() int32 { return 0x05 } -func (p *Ping) Encode(w io.Writer) error { +func (p *Ping) Encode(w encoding.Writer) error { return w.Int(p.ID_) } -func (p *Ping) Decode(r io.Reader) error { +func (p *Ping) Decode(r encoding.Reader) error { return r.Int(&p.ID_) } diff --git a/protocol/net/packet/configuration/plugin.go b/protocol/net/packet/configuration/plugin.go index 61e87b6e..dc232e98 100644 --- a/protocol/net/packet/configuration/plugin.go +++ b/protocol/net/packet/configuration/plugin.go @@ -1,8 +1,10 @@ package configuration -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) -//two-sided +// two-sided const PacketIdPluginMessage = 0x01 type ClientboundPluginMessage struct { @@ -14,14 +16,14 @@ func (ClientboundPluginMessage) ID() int32 { return 0x01 } -func (c *ClientboundPluginMessage) Encode(w io.Writer) error { +func (c *ClientboundPluginMessage) Encode(w encoding.Writer) error { if err := w.Identifier(c.Channel); err != nil { return err } return w.FixedByteArray(c.Data) } -func (c *ClientboundPluginMessage) Decode(r io.Reader) error { +func (c *ClientboundPluginMessage) Decode(r encoding.Reader) error { if err := r.Identifier(&c.Channel); err != nil { return err } diff --git a/protocol/net/packet/configuration/registryData.go b/protocol/net/packet/configuration/registryData.go index 2ba6f834..778ca7fc 100644 --- a/protocol/net/packet/configuration/registryData.go +++ b/protocol/net/packet/configuration/registryData.go @@ -4,7 +4,7 @@ import ( "reflect" "sync" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/registry" ) @@ -35,7 +35,7 @@ func (RegistryData) ID() int32 { return 0x07 } -func (r *RegistryData) Encode(w io.Writer) error { +func (r *RegistryData) Encode(w encoding.Writer) error { if err := w.Identifier(r.RegistryId); err != nil { return err } @@ -90,7 +90,7 @@ func (r *RegistryData) Encode(w io.Writer) error { return nil } -func (d *RegistryData) Decode(r io.Reader) error { +func (d *RegistryData) Decode(r encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/handshake/handshake.go b/protocol/net/packet/handshake/handshake.go index 3e1daea3..a255ef17 100644 --- a/protocol/net/packet/handshake/handshake.go +++ b/protocol/net/packet/handshake/handshake.go @@ -1,7 +1,7 @@ package handshake import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) const ( @@ -24,7 +24,7 @@ func (Handshaking) ID() int32 { return 0x00 } -func (h *Handshaking) Decode(r io.Reader) error { +func (h *Handshaking) Decode(r encoding.Reader) error { if _, err := r.VarInt(&h.ProtocolVersion); err != nil { return err } @@ -38,7 +38,7 @@ func (h *Handshaking) Decode(r io.Reader) error { return err } -func (h Handshaking) Encode(w io.Writer) error { +func (h Handshaking) Encode(w encoding.Writer) error { if err := w.VarInt(h.ProtocolVersion); err != nil { return err } diff --git a/protocol/net/packet/login/cookie.go b/protocol/net/packet/login/cookie.go index ff7822eb..20fe2ae5 100644 --- a/protocol/net/packet/login/cookie.go +++ b/protocol/net/packet/login/cookie.go @@ -1,6 +1,8 @@ package login -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdCookieRequest = 0x05 @@ -13,11 +15,11 @@ func (CookieRequest) ID() int32 { return 0x05 } -func (s *CookieRequest) Encode(w io.Writer) error { +func (s *CookieRequest) Encode(w encoding.Writer) error { return w.String(s.Key) } -func (s *CookieRequest) Decode(r io.Reader) error { +func (s *CookieRequest) Decode(r encoding.Reader) error { return r.String(&s.Key) } @@ -31,7 +33,7 @@ func (CookieResponse) ID() int32 { return 0x04 } -func (s *CookieResponse) Encode(w io.Writer) error { +func (s *CookieResponse) Encode(w encoding.Writer) error { if err := w.String(s.Key); err != nil { return err } @@ -44,7 +46,7 @@ func (s *CookieResponse) Encode(w io.Writer) error { return nil } -func (s *CookieResponse) Decode(r io.Reader) error { +func (s *CookieResponse) Decode(r encoding.Reader) error { if err := r.String(&s.Key); err != nil { return err } diff --git a/protocol/net/packet/login/disconnect.go b/protocol/net/packet/login/disconnect.go index 42cae46d..8df8c497 100644 --- a/protocol/net/packet/login/disconnect.go +++ b/protocol/net/packet/login/disconnect.go @@ -1,7 +1,7 @@ package login import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -16,10 +16,10 @@ func (Disconnect) ID() int32 { return 0x00 } -func (d *Disconnect) Encode(w io.Writer) error { +func (d *Disconnect) Encode(w encoding.Writer) error { return w.JSONTextComponent(d.Reason) } -func (d *Disconnect) Decode(r io.Reader) error { +func (d *Disconnect) Decode(r encoding.Reader) error { return r.JSONTextComponent(&d.Reason) } diff --git a/protocol/net/packet/login/encryption.go b/protocol/net/packet/login/encryption.go index 31d6269d..a42f8e34 100644 --- a/protocol/net/packet/login/encryption.go +++ b/protocol/net/packet/login/encryption.go @@ -1,8 +1,10 @@ package login -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) -//two-sided +// two-sided const PacketIdEncryption = 0x01 type EncryptionRequest struct { @@ -15,7 +17,7 @@ func (EncryptionRequest) ID() int32 { return 0x01 } -func (e *EncryptionRequest) Encode(w io.Writer) error { +func (e *EncryptionRequest) Encode(w encoding.Writer) error { if err := w.String(""); err != nil { return err } @@ -28,7 +30,7 @@ func (e *EncryptionRequest) Encode(w io.Writer) error { return w.Bool(e.ShouldAuthenticate) } -func (e *EncryptionRequest) Decode(r io.Reader) error { +func (e *EncryptionRequest) Decode(r encoding.Reader) error { var s string if err := r.String(&s); err != nil { return err @@ -51,14 +53,14 @@ func (EncryptionResponse) ID() int32 { return 0x01 } -func (e *EncryptionResponse) Encode(w io.Writer) error { +func (e *EncryptionResponse) Encode(w encoding.Writer) error { if err := w.ByteArray(e.SharedSecret); err != nil { return err } return w.ByteArray(e.VerifyToken) } -func (e *EncryptionResponse) Decode(r io.Reader) error { +func (e *EncryptionResponse) Decode(r encoding.Reader) error { if err := r.ByteArray(&e.SharedSecret); err != nil { return err } diff --git a/protocol/net/packet/login/loginStart.go b/protocol/net/packet/login/loginStart.go index 6f12b5da..dcdb6307 100644 --- a/protocol/net/packet/login/loginStart.go +++ b/protocol/net/packet/login/loginStart.go @@ -1,9 +1,8 @@ package login import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" - "github.com/google/uuid" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) // serverbound @@ -18,14 +17,14 @@ func (LoginStart) ID() int32 { return 0x00 } -func (l *LoginStart) Encode(w io.Writer) error { +func (l *LoginStart) Encode(w encoding.Writer) error { if err := w.String(l.Name); err != nil { return err } return w.UUID(l.PlayerUUID) } -func (l *LoginStart) Decode(r io.Reader) error { +func (l *LoginStart) Decode(r encoding.Reader) error { if err := r.String(&l.Name); err != nil { return err } diff --git a/protocol/net/packet/login/loginSuccess.go b/protocol/net/packet/login/loginSuccess.go index cf72f841..d47985fd 100644 --- a/protocol/net/packet/login/loginSuccess.go +++ b/protocol/net/packet/login/loginSuccess.go @@ -3,9 +3,8 @@ package login import ( "fmt" - "github.com/zeppelinmc/zeppelin/protocol/net/io" - "github.com/google/uuid" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) type Textures struct { @@ -46,7 +45,7 @@ func (LoginSuccess) ID() int32 { return 0x02 } -func (l *LoginSuccess) Encode(w io.Writer) error { +func (l *LoginSuccess) Encode(w encoding.Writer) error { if err := w.UUID(l.UUID); err != nil { return err } @@ -75,7 +74,7 @@ func (l *LoginSuccess) Encode(w io.Writer) error { return w.Bool(l.StrictErrorHandling) } -func (l *LoginSuccess) Decode(r io.Reader) error { +func (l *LoginSuccess) Decode(r encoding.Reader) error { if err := r.UUID(&l.UUID); err != nil { return err } @@ -118,10 +117,10 @@ func (LoginAcknowledged) ID() int32 { return 0x03 } -func (*LoginAcknowledged) Encode(io.Writer) error { +func (*LoginAcknowledged) Encode(encoding.Writer) error { return nil } -func (*LoginAcknowledged) Decode(io.Reader) error { +func (*LoginAcknowledged) Decode(encoding.Reader) error { return nil } diff --git a/protocol/net/packet/login/plugin.go b/protocol/net/packet/login/plugin.go index bbe66687..d146180e 100644 --- a/protocol/net/packet/login/plugin.go +++ b/protocol/net/packet/login/plugin.go @@ -1,8 +1,10 @@ package login -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) -//clientbound +// clientbound const PacketIdLoginPluginRequest = 0x04 type LoginPluginRequest struct { @@ -15,7 +17,7 @@ func (LoginPluginRequest) ID() int32 { return 0x04 } -func (l *LoginPluginRequest) Encode(w io.Writer) error { +func (l *LoginPluginRequest) Encode(w encoding.Writer) error { if err := w.VarInt(l.MessageID); err != nil { return err } @@ -25,7 +27,7 @@ func (l *LoginPluginRequest) Encode(w io.Writer) error { return w.FixedByteArray(l.Data) } -func (l *LoginPluginRequest) Decode(r io.Reader) error { +func (l *LoginPluginRequest) Decode(r encoding.Reader) error { if _, err := r.VarInt(&l.MessageID); err != nil { return err } @@ -35,7 +37,7 @@ func (l *LoginPluginRequest) Decode(r io.Reader) error { return r.ReadAll(&l.Data) } -//serverbound +// serverbound const PacketIdLoginPluginResponse = 0x02 type LoginPluginResponse struct { @@ -48,7 +50,7 @@ func (LoginPluginResponse) ID() int32 { return 0x02 } -func (l *LoginPluginResponse) Encode(w io.Writer) error { +func (l *LoginPluginResponse) Encode(w encoding.Writer) error { if err := w.VarInt(l.MessageID); err != nil { return err } @@ -63,7 +65,7 @@ func (l *LoginPluginResponse) Encode(w io.Writer) error { return nil } -func (l *LoginPluginResponse) Decode(r io.Reader) error { +func (l *LoginPluginResponse) Decode(r encoding.Reader) error { if _, err := r.VarInt(&l.MessageID); err != nil { return err } diff --git a/protocol/net/packet/login/setCompression.go b/protocol/net/packet/login/setCompression.go index f152010d..4a2fb688 100644 --- a/protocol/net/packet/login/setCompression.go +++ b/protocol/net/packet/login/setCompression.go @@ -1,8 +1,10 @@ package login -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) -//clientbound +// clientbound const PacketIdSetCompression = 0x03 type SetCompression struct { @@ -13,11 +15,11 @@ func (SetCompression) ID() int32 { return 0x03 } -func (s *SetCompression) Encode(w io.Writer) error { +func (s *SetCompression) Encode(w encoding.Writer) error { return w.VarInt(s.Threshold) } -func (s *SetCompression) Decode(r io.Reader) error { +func (s *SetCompression) Decode(r encoding.Reader) error { _, err := r.VarInt(&s.Threshold) return err } diff --git a/protocol/net/packet/packet.go b/protocol/net/packet/packet.go index 8f7ff3dc..5cfdc303 100644 --- a/protocol/net/packet/packet.go +++ b/protocol/net/packet/packet.go @@ -1,46 +1,44 @@ package packet -import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" -) +import "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" // A clientbound packet type Encodeable interface { ID() int32 - Encode(io.Writer) error + Encode(encoding.Writer) error } // A serverbound packet type Decodeable interface { ID() int32 - Decode(io.Reader) error + Decode(encoding.Reader) error } type UnknownPacket struct { Id int32 Length int32 - Payload io.Reader + Payload encoding.Reader } func (u UnknownPacket) ID() int32 { return u.Id } -func (u UnknownPacket) Decode(io.Reader) error { +func (u UnknownPacket) Decode(encoding.Reader) error { return nil } -func (u UnknownPacket) Encode(io.Writer) error { +func (u UnknownPacket) Encode(encoding.Writer) error { return nil } type EmptyPacket struct { } -func (pk EmptyPacket) Encode(io.Writer) error { +func (pk EmptyPacket) Encode(encoding.Writer) error { return nil } -func (pk EmptyPacket) Decode(io.Reader) error { +func (pk EmptyPacket) Decode(encoding.Reader) error { return nil } diff --git a/protocol/net/packet/play/acknowledgeBlockChange.go b/protocol/net/packet/play/acknowledgeBlockChange.go index b4b18520..d5c029e6 100644 --- a/protocol/net/packet/play/acknowledgeBlockChange.go +++ b/protocol/net/packet/play/acknowledgeBlockChange.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdAcknowledgeBlockChange = 0x05 @@ -13,11 +15,11 @@ func (AcknowledgeBlockChange) ID() int32 { return PacketIdAcknowledgeBlockChange } -func (b *AcknowledgeBlockChange) Encode(w io.Writer) error { +func (b *AcknowledgeBlockChange) Encode(w encoding.Writer) error { return w.VarInt(b.SequenceId) } -func (b *AcknowledgeBlockChange) Decode(r io.Reader) error { +func (b *AcknowledgeBlockChange) Decode(r encoding.Reader) error { _, err := r.VarInt(&b.SequenceId) return err } diff --git a/protocol/net/packet/play/blockAction.go b/protocol/net/packet/play/blockAction.go index 12013fd6..e9baef5c 100644 --- a/protocol/net/packet/play/blockAction.go +++ b/protocol/net/packet/play/blockAction.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdBlockAction = 0x08 @@ -15,7 +17,7 @@ func (BlockAction) ID() int32 { return PacketIdBlockAction } -func (b *BlockAction) Encode(w io.Writer) error { +func (b *BlockAction) Encode(w encoding.Writer) error { if err := w.Position(b.X, b.Y, b.Z); err != nil { return err } @@ -28,7 +30,7 @@ func (b *BlockAction) Encode(w io.Writer) error { return w.VarInt(b.BlockType) } -func (b *BlockAction) Decode(r io.Reader) error { +func (b *BlockAction) Decode(r encoding.Reader) error { if err := r.Position(&b.X, &b.Y, &b.Z); err != nil { return err } diff --git a/protocol/net/packet/play/blockEntityData.go b/protocol/net/packet/play/blockEntityData.go index 2183675b..e255b36b 100644 --- a/protocol/net/packet/play/blockEntityData.go +++ b/protocol/net/packet/play/blockEntityData.go @@ -2,7 +2,7 @@ package play import ( "github.com/zeppelinmc/zeppelin/protocol/nbt" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) // clientbound @@ -18,7 +18,7 @@ func (BlockEntityData) ID() int32 { return PacketIdBlockEntityData } -func (b *BlockEntityData) Encode(w io.Writer) error { +func (b *BlockEntityData) Encode(w encoding.Writer) error { if err := w.Position(b.X, b.Y, b.Z); err != nil { return err } @@ -31,6 +31,6 @@ func (b *BlockEntityData) Encode(w io.Writer) error { return w.NBT(b.Data) } -func (b *BlockEntityData) Decode(r io.Reader) error { +func (b *BlockEntityData) Decode(r encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/play/blockUpdate.go b/protocol/net/packet/play/blockUpdate.go index ff98b14d..faeb1e82 100644 --- a/protocol/net/packet/play/blockUpdate.go +++ b/protocol/net/packet/play/blockUpdate.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdBlockUpdate = 0x09 @@ -14,14 +16,14 @@ func (BlockUpdate) ID() int32 { return PacketIdBlockUpdate } -func (b *BlockUpdate) Encode(w io.Writer) error { +func (b *BlockUpdate) Encode(w encoding.Writer) error { if err := w.Position(b.X, b.Y, b.Z); err != nil { return err } return w.VarInt(b.BlockId) } -func (b *BlockUpdate) Decode(r io.Reader) error { +func (b *BlockUpdate) Decode(r encoding.Reader) error { if err := r.Position(&b.X, &b.Y, &b.Z); err != nil { return err } diff --git a/protocol/net/packet/play/changeDifficulty.go b/protocol/net/packet/play/changeDifficulty.go index 2e43b337..7b67d108 100644 --- a/protocol/net/packet/play/changeDifficulty.go +++ b/protocol/net/packet/play/changeDifficulty.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdChangeDifficulty = 0x0B @@ -14,14 +16,14 @@ func (ChangeDifficulty) ID() int32 { return PacketIdChangeDifficulty } -func (c *ChangeDifficulty) Encode(w io.Writer) error { +func (c *ChangeDifficulty) Encode(w encoding.Writer) error { if err := w.Ubyte(c.Difficulty); err != nil { return err } return w.Bool(c.Locked) } -func (c *ChangeDifficulty) Decode(r io.Reader) error { +func (c *ChangeDifficulty) Decode(r encoding.Reader) error { if err := r.Ubyte(&c.Difficulty); err != nil { return err } diff --git a/protocol/net/packet/play/chatCommand.go b/protocol/net/packet/play/chatCommand.go index cf14be26..2dcf3ecc 100644 --- a/protocol/net/packet/play/chatCommand.go +++ b/protocol/net/packet/play/chatCommand.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdChatCommand = 0x04 @@ -13,10 +15,10 @@ func (ChatCommand) ID() int32 { return PacketIdChatCommand } -func (c *ChatCommand) Encode(w io.Writer) error { +func (c *ChatCommand) Encode(w encoding.Writer) error { return w.String(c.Command) } -func (c *ChatCommand) Decode(r io.Reader) error { +func (c *ChatCommand) Decode(r encoding.Reader) error { return r.String(&c.Command) } diff --git a/protocol/net/packet/play/chatMessage.go b/protocol/net/packet/play/chatMessage.go index 7c675f73..279c2a6b 100644 --- a/protocol/net/packet/play/chatMessage.go +++ b/protocol/net/packet/play/chatMessage.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) // serverbound @@ -15,14 +15,14 @@ type ChatMessage struct { Signature [256]byte MessageCount int32 - Acknowledged io.FixedBitSet + Acknowledged encoding.FixedBitSet } func (ChatMessage) ID() int32 { return 0x06 } -func (c *ChatMessage) Encode(w io.Writer) error { +func (c *ChatMessage) Encode(w encoding.Writer) error { if err := w.String(c.Message); err != nil { return err } @@ -46,7 +46,7 @@ func (c *ChatMessage) Encode(w io.Writer) error { return w.FixedBitSet(c.Acknowledged) } -func (c *ChatMessage) Decode(r io.Reader) error { +func (c *ChatMessage) Decode(r encoding.Reader) error { if err := r.String(&c.Message); err != nil { return err } diff --git a/protocol/net/packet/play/chunkBatch.go b/protocol/net/packet/play/chunkBatch.go index e04ce9ad..9c4fbc04 100644 --- a/protocol/net/packet/play/chunkBatch.go +++ b/protocol/net/packet/play/chunkBatch.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/packet" ) @@ -16,11 +16,11 @@ func (ChunkBatchFinished) ID() int32 { return PacketIdChunkBatchFinished } -func (c *ChunkBatchFinished) Encode(w io.Writer) error { +func (c *ChunkBatchFinished) Encode(w encoding.Writer) error { return w.VarInt(c.BatchSize) } -func (c *ChunkBatchFinished) Decode(r io.Reader) error { +func (c *ChunkBatchFinished) Decode(r encoding.Reader) error { _, err := r.VarInt(&c.BatchSize) return err } @@ -45,10 +45,10 @@ func (ChunkBatchReceived) ID() int32 { return PacketIdChunkBatchReceived } -func (c *ChunkBatchReceived) Encode(w io.Writer) error { +func (c *ChunkBatchReceived) Encode(w encoding.Writer) error { return w.Float(c.ChunksPerTick) } -func (c *ChunkBatchReceived) Decode(r io.Reader) error { +func (c *ChunkBatchReceived) Decode(r encoding.Reader) error { return r.Float(&c.ChunksPerTick) } diff --git a/protocol/net/packet/play/chunkData.go b/protocol/net/packet/play/chunkData.go index cb56614d..5892348b 100644 --- a/protocol/net/packet/play/chunkData.go +++ b/protocol/net/packet/play/chunkData.go @@ -3,7 +3,7 @@ package play import ( "bytes" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) type BlockEntity struct { @@ -24,7 +24,7 @@ type ChunkDataUpdateLight struct { Heightmaps Heightmaps Data *bytes.Buffer //[]byte BlockEntities []BlockEntity - SkyLightMask, BlockLightMask, EmptySkyLightMask, EmptyBlockLightMask io.BitSet + SkyLightMask, BlockLightMask, EmptySkyLightMask, EmptyBlockLightMask encoding.BitSet SkyLightArrays [][]byte BlockLightArrays [][]byte } @@ -33,7 +33,7 @@ func (ChunkDataUpdateLight) ID() int32 { return 0x27 } -func (c *ChunkDataUpdateLight) Encode(w io.Writer) error { +func (c *ChunkDataUpdateLight) Encode(w encoding.Writer) error { if err := w.Int(c.CX); err != nil { return err } @@ -103,6 +103,6 @@ func (c *ChunkDataUpdateLight) Encode(w io.Writer) error { return nil } -func (c *ChunkDataUpdateLight) Decode(io.Reader) error { +func (c *ChunkDataUpdateLight) Decode(encoding.Reader) error { return nil } diff --git a/protocol/net/packet/play/closeContainer.go b/protocol/net/packet/play/closeContainer.go index 324123f9..e61460d0 100644 --- a/protocol/net/packet/play/closeContainer.go +++ b/protocol/net/packet/play/closeContainer.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdCloseContainer = 0x0F @@ -13,10 +15,10 @@ func (CloseContainer) ID() int32 { return PacketIdCloseContainer } -func (c *CloseContainer) Encode(w io.Writer) error { +func (c *CloseContainer) Encode(w encoding.Writer) error { return w.Ubyte(c.WindowId) } -func (c *CloseContainer) Decode(r io.Reader) error { +func (c *CloseContainer) Decode(r encoding.Reader) error { return r.Ubyte(&c.WindowId) } diff --git a/protocol/net/packet/play/commands.go b/protocol/net/packet/play/commands.go index bb11c3c2..f146ffe3 100644 --- a/protocol/net/packet/play/commands.go +++ b/protocol/net/packet/play/commands.go @@ -3,7 +3,7 @@ package play import ( "fmt" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) type Node struct { @@ -51,7 +51,7 @@ func (Commands) ID() int32 { return PacketIdCommands } -func (c *Commands) Encode(w io.Writer) error { +func (c *Commands) Encode(w encoding.Writer) error { if err := w.VarInt(int32(len(c.Nodes))); err != nil { return err } @@ -63,7 +63,7 @@ func (c *Commands) Encode(w io.Writer) error { return w.VarInt(c.RootIndex) } -func (c *Commands) encodeNode(w io.Writer, node Node) error { +func (c *Commands) encodeNode(w encoding.Writer, node Node) error { if err := w.Byte(node.Flags); err != nil { return err } @@ -133,7 +133,3 @@ func (c *Commands) encodeNode(w io.Writer, node Node) error { } return nil } - -func (*Commands) Decode(io.Reader) error { - return nil //TODO -} diff --git a/protocol/net/packet/play/confirmTeleport.go b/protocol/net/packet/play/confirmTeleport.go index 8fb10872..83ec008d 100644 --- a/protocol/net/packet/play/confirmTeleport.go +++ b/protocol/net/packet/play/confirmTeleport.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdConfirmTeleportation = 0x00 @@ -13,11 +15,11 @@ func (ConfirmTeleportation) ID() int32 { return PacketIdConfirmTeleportation } -func (c *ConfirmTeleportation) Encode(w io.Writer) error { +func (c *ConfirmTeleportation) Encode(w encoding.Writer) error { return w.VarInt(c.TeleportId) } -func (c *ConfirmTeleportation) Decode(r io.Reader) error { +func (c *ConfirmTeleportation) Decode(r encoding.Reader) error { _, err := r.VarInt(&c.TeleportId) return err } diff --git a/protocol/net/packet/play/damageEvent.go b/protocol/net/packet/play/damageEvent.go index 7a981598..4d2b491f 100644 --- a/protocol/net/packet/play/damageEvent.go +++ b/protocol/net/packet/play/damageEvent.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdDamageEvent = 0x1A @@ -19,7 +21,7 @@ func (DamageEvent) ID() int32 { return PacketIdDamageEvent } -func (d *DamageEvent) Encode(w io.Writer) error { +func (d *DamageEvent) Encode(w encoding.Writer) error { if err := w.VarInt(d.EntityId); err != nil { return err } @@ -49,6 +51,6 @@ func (d *DamageEvent) Encode(w io.Writer) error { return nil } -func (d *DamageEvent) Decode(r io.Reader) error { +func (d *DamageEvent) Decode(r encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/play/deleteMessage.go b/protocol/net/packet/play/deleteMessage.go index 22975195..bfab9774 100644 --- a/protocol/net/packet/play/deleteMessage.go +++ b/protocol/net/packet/play/deleteMessage.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdDeleteMessage = 0x1C @@ -14,7 +16,7 @@ func (DeleteMessage) ID() int32 { return PacketIdDeleteMessage } -func (b *DeleteMessage) Encode(w io.Writer) error { +func (b *DeleteMessage) Encode(w encoding.Writer) error { if err := w.VarInt(b.MessageId + 1); err != nil { return err } @@ -24,7 +26,7 @@ func (b *DeleteMessage) Encode(w io.Writer) error { return nil } -func (b *DeleteMessage) Decode(r io.Reader) error { +func (b *DeleteMessage) Decode(r encoding.Reader) error { if _, err := r.VarInt(&b.MessageId); err != nil { return err } diff --git a/protocol/net/packet/play/disconnect.go b/protocol/net/packet/play/disconnect.go index 2f047924..da95cd64 100644 --- a/protocol/net/packet/play/disconnect.go +++ b/protocol/net/packet/play/disconnect.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -16,10 +16,10 @@ func (Disconnect) ID() int32 { return 0x1D } -func (d *Disconnect) Encode(w io.Writer) error { +func (d *Disconnect) Encode(w encoding.Writer) error { return w.TextComponent(d.Reason) } -func (d *Disconnect) Decode(r io.Reader) error { +func (d *Disconnect) Decode(r encoding.Reader) error { return r.TextComponent(&d.Reason) } diff --git a/protocol/net/packet/play/disguisedChatMessage.go b/protocol/net/packet/play/disguisedChatMessage.go index e0c65815..3afcb738 100644 --- a/protocol/net/packet/play/disguisedChatMessage.go +++ b/protocol/net/packet/play/disguisedChatMessage.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -21,7 +21,7 @@ func (DisguisedChatMessage) ID() int32 { return PacketIdDisguisedChatMessage } -func (p *DisguisedChatMessage) Encode(w io.Writer) error { +func (p *DisguisedChatMessage) Encode(w encoding.Writer) error { if err := w.TextComponent(p.Message); err != nil { return err } @@ -45,7 +45,7 @@ func (p *DisguisedChatMessage) Encode(w io.Writer) error { return nil } -func (p *DisguisedChatMessage) Decode(r io.Reader) error { +func (p *DisguisedChatMessage) Decode(r encoding.Reader) error { if err := r.TextComponent(&p.Message); err != nil { return err } diff --git a/protocol/net/packet/play/entityAnimation.go b/protocol/net/packet/play/entityAnimation.go index 328782be..227e736e 100644 --- a/protocol/net/packet/play/entityAnimation.go +++ b/protocol/net/packet/play/entityAnimation.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdEntityAnimation = 0x03 @@ -23,14 +25,14 @@ func (EntityAnimation) ID() int32 { return PacketIdEntityAnimation } -func (e *EntityAnimation) Encode(w io.Writer) error { +func (e *EntityAnimation) Encode(w encoding.Writer) error { if err := w.VarInt(e.EntityId); err != nil { return err } return w.Ubyte(e.Animation) } -func (e *EntityAnimation) Decode(r io.Reader) error { +func (e *EntityAnimation) Decode(r encoding.Reader) error { if _, err := r.VarInt(&e.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/entityEvent.go b/protocol/net/packet/play/entityEvent.go index 8465a0ec..0342a854 100644 --- a/protocol/net/packet/play/entityEvent.go +++ b/protocol/net/packet/play/entityEvent.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdEntityEvent = 0x1F @@ -14,14 +16,14 @@ func (EntityEvent) ID() int32 { return PacketIdEntityEvent } -func (e *EntityEvent) Encode(w io.Writer) error { +func (e *EntityEvent) Encode(w encoding.Writer) error { if err := w.Int(e.EntityId); err != nil { return err } return w.Byte(e.EntityStatus) } -func (e *EntityEvent) Decode(r io.Reader) error { +func (e *EntityEvent) Decode(r encoding.Reader) error { if err := r.Int(&e.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/entitySoundEffect.go b/protocol/net/packet/play/entitySoundEffect.go index 42c71b9f..5e8879fd 100644 --- a/protocol/net/packet/play/entitySoundEffect.go +++ b/protocol/net/packet/play/entitySoundEffect.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdEntitySoundEffect = 0x67 @@ -21,7 +23,7 @@ func (EntitySoundEffect) ID() int32 { return PacketIdEntitySoundEffect } -func (s *EntitySoundEffect) Encode(w io.Writer) error { +func (s *EntitySoundEffect) Encode(w encoding.Writer) error { if err := w.VarInt(s.SoundId + 1); err != nil { return err } @@ -53,6 +55,6 @@ func (s *EntitySoundEffect) Encode(w io.Writer) error { return w.Long(s.Seed) } -func (s *EntitySoundEffect) Decode(r io.Reader) error { +func (s *EntitySoundEffect) Decode(r encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/play/gameEvent.go b/protocol/net/packet/play/gameEvent.go index a50ca754..9935e427 100644 --- a/protocol/net/packet/play/gameEvent.go +++ b/protocol/net/packet/play/gameEvent.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) const ( GameEventNoRespawnBlockAvailable = iota @@ -19,7 +21,7 @@ const ( GameEventStartWaitingChunks ) -//clientbound +// clientbound const PacketIdGameEvent = 0x22 type GameEvent struct { @@ -31,14 +33,14 @@ func (GameEvent) ID() int32 { return 0x22 } -func (g *GameEvent) Encode(w io.Writer) error { +func (g *GameEvent) Encode(w encoding.Writer) error { if err := w.Ubyte(g.Event); err != nil { return err } return w.Float(g.Value) } -func (g *GameEvent) Decode(r io.Reader) error { +func (g *GameEvent) Decode(r encoding.Reader) error { if err := r.Ubyte(&g.Event); err != nil { return err } diff --git a/protocol/net/packet/play/hurtAnimation.go b/protocol/net/packet/play/hurtAnimation.go index e250cc92..36108cba 100644 --- a/protocol/net/packet/play/hurtAnimation.go +++ b/protocol/net/packet/play/hurtAnimation.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdHurtAnimation = 0x24 @@ -14,14 +16,14 @@ func (HurtAnimation) ID() int32 { return PacketIdHurtAnimation } -func (d *HurtAnimation) Encode(w io.Writer) error { +func (d *HurtAnimation) Encode(w encoding.Writer) error { if err := w.VarInt(d.EntityId); err != nil { return err } return w.Float(d.Yaw) } -func (d *HurtAnimation) Decode(r io.Reader) error { +func (d *HurtAnimation) Decode(r encoding.Reader) error { if _, err := r.VarInt(&d.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/interact.go b/protocol/net/packet/play/interact.go index 3d0d9057..b49e9dc6 100644 --- a/protocol/net/packet/play/interact.go +++ b/protocol/net/packet/play/interact.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdInteract = 0x16 @@ -23,7 +25,7 @@ func (Interact) ID() int32 { return PacketIdInteract } -func (i *Interact) Encode(w io.Writer) error { +func (i *Interact) Encode(w encoding.Writer) error { if err := w.VarInt(i.EntityId); err != nil { return err } @@ -50,7 +52,7 @@ func (i *Interact) Encode(w io.Writer) error { return w.Bool(i.Sneaking) } -func (i *Interact) Decode(r io.Reader) error { +func (i *Interact) Decode(r encoding.Reader) error { if _, err := r.VarInt(&i.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/keepAlive.go b/protocol/net/packet/play/keepAlive.go index 107f0f13..8a1ad40f 100644 --- a/protocol/net/packet/play/keepAlive.go +++ b/protocol/net/packet/play/keepAlive.go @@ -1,8 +1,10 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) -//serverbound +// serverbound const PacketIdServerboundKeepAlive = 0x18 type ServerboundKeepAlive struct { @@ -13,15 +15,15 @@ func (ServerboundKeepAlive) ID() int32 { return 0x18 } -func (k *ServerboundKeepAlive) Encode(w io.Writer) error { +func (k *ServerboundKeepAlive) Encode(w encoding.Writer) error { return w.Long(k.KeepAliveID) } -func (k *ServerboundKeepAlive) Decode(r io.Reader) error { +func (k *ServerboundKeepAlive) Decode(r encoding.Reader) error { return r.Long(&k.KeepAliveID) } -//clientbound +// clientbound const PacketIdClientboundKeepAlive = 0x26 type ClientboundKeepAlive struct { @@ -32,10 +34,10 @@ func (ClientboundKeepAlive) ID() int32 { return 0x26 } -func (k *ClientboundKeepAlive) Encode(w io.Writer) error { +func (k *ClientboundKeepAlive) Encode(w encoding.Writer) error { return w.Long(k.KeepAliveID) } -func (k *ClientboundKeepAlive) Decode(r io.Reader) error { +func (k *ClientboundKeepAlive) Decode(r encoding.Reader) error { return r.Long(&k.KeepAliveID) } diff --git a/protocol/net/packet/play/login.go b/protocol/net/packet/play/login.go index e76503df..96dd18b9 100644 --- a/protocol/net/packet/play/login.go +++ b/protocol/net/packet/play/login.go @@ -3,7 +3,7 @@ package play import ( "fmt" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) // clientbound @@ -44,7 +44,7 @@ func (Login) ID() int32 { return 0x2B } -func (l *Login) Encode(w io.Writer) error { +func (l *Login) Encode(w encoding.Writer) error { if err := w.Int(l.EntityID); err != nil { return err } @@ -116,7 +116,7 @@ func (l *Login) Encode(w io.Writer) error { return w.Bool(l.EnforcesSecureChat) } -func (l *Login) Decode(r io.Reader) error { +func (l *Login) Decode(r encoding.Reader) error { if err := r.Int(&l.EntityID); err != nil { return err } diff --git a/protocol/net/packet/play/openScreen.go b/protocol/net/packet/play/openScreen.go index e0ce1ad1..89fb53f6 100644 --- a/protocol/net/packet/play/openScreen.go +++ b/protocol/net/packet/play/openScreen.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -18,7 +18,7 @@ func (OpenScreen) ID() int32 { return PacketIdOpenScreen } -func (o *OpenScreen) Encode(w io.Writer) error { +func (o *OpenScreen) Encode(w encoding.Writer) error { if err := w.VarInt(o.WindowId); err != nil { return err } @@ -28,7 +28,7 @@ func (o *OpenScreen) Encode(w io.Writer) error { return w.TextComponent(o.WindowTitle) } -func (o *OpenScreen) Decode(r io.Reader) error { +func (o *OpenScreen) Decode(r encoding.Reader) error { if _, err := r.VarInt(&o.WindowId); err != nil { return err } diff --git a/protocol/net/packet/play/playerAbilitiesCB.go b/protocol/net/packet/play/playerAbilitiesCB.go index 9e786323..3a982ddc 100644 --- a/protocol/net/packet/play/playerAbilitiesCB.go +++ b/protocol/net/packet/play/playerAbilitiesCB.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdPlayerAbilitiesClientbound = 0x38 @@ -21,7 +23,7 @@ func (PlayerAbilitiesClientbound) ID() int32 { return PacketIdPlayerAbilitiesClientbound } -func (a *PlayerAbilitiesClientbound) Encode(w io.Writer) error { +func (a *PlayerAbilitiesClientbound) Encode(w encoding.Writer) error { if err := w.Byte(a.Flags); err != nil { return err } @@ -31,7 +33,7 @@ func (a *PlayerAbilitiesClientbound) Encode(w io.Writer) error { return w.Float(a.FOVModifier) } -func (a *PlayerAbilitiesClientbound) Decode(r io.Reader) error { +func (a *PlayerAbilitiesClientbound) Decode(r encoding.Reader) error { if err := r.Byte(&a.Flags); err != nil { return err } diff --git a/protocol/net/packet/play/playerAbilitiesSB.go b/protocol/net/packet/play/playerAbilitiesSB.go index 0b8aff9b..87a7b3dc 100644 --- a/protocol/net/packet/play/playerAbilitiesSB.go +++ b/protocol/net/packet/play/playerAbilitiesSB.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdPlayerAbilitiesServerbound = 0x23 @@ -13,10 +15,10 @@ func (PlayerAbilitiesServerbound) ID() int32 { return PacketIdPlayerAbilitiesServerbound } -func (a *PlayerAbilitiesServerbound) Encode(w io.Writer) error { +func (a *PlayerAbilitiesServerbound) Encode(w encoding.Writer) error { return w.Byte(a.Flags) } -func (a *PlayerAbilitiesServerbound) Decode(r io.Reader) error { +func (a *PlayerAbilitiesServerbound) Decode(r encoding.Reader) error { return r.Byte(&a.Flags) } diff --git a/protocol/net/packet/play/playerChatMessage.go b/protocol/net/packet/play/playerChatMessage.go index 84a46c9c..ec05e863 100644 --- a/protocol/net/packet/play/playerChatMessage.go +++ b/protocol/net/packet/play/playerChatMessage.go @@ -2,7 +2,7 @@ package play import ( "github.com/google/uuid" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -33,7 +33,7 @@ type PlayerChatMessage struct { UnsignedContent *text.TextComponent FilterType int32 - FilterBits io.BitSet + FilterBits encoding.BitSet ChatType int32 SenderName text.TextComponent @@ -45,7 +45,7 @@ func (PlayerChatMessage) ID() int32 { return PacketIdPlayerChatMessage } -func (p *PlayerChatMessage) Encode(w io.Writer) error { +func (p *PlayerChatMessage) Encode(w encoding.Writer) error { if err := w.UUID(p.Sender); err != nil { return err } @@ -121,6 +121,6 @@ func (p *PlayerChatMessage) Encode(w io.Writer) error { return nil } -func (p *PlayerChatMessage) Decode(r io.Reader) error { +func (p *PlayerChatMessage) Decode(r encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/play/playerCommand.go b/protocol/net/packet/play/playerCommand.go index e41908ed..d56fc2b7 100644 --- a/protocol/net/packet/play/playerCommand.go +++ b/protocol/net/packet/play/playerCommand.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdPlayerCommand = 0x25 @@ -27,7 +29,7 @@ func (PlayerCommand) ID() int32 { return PacketIdPlayerCommand } -func (p *PlayerCommand) Encode(w io.Writer) error { +func (p *PlayerCommand) Encode(w encoding.Writer) error { if err := w.VarInt(p.EntityId); err != nil { return err } @@ -37,7 +39,7 @@ func (p *PlayerCommand) Encode(w io.Writer) error { return w.VarInt(p.JumpBoost) } -func (p *PlayerCommand) Decode(r io.Reader) error { +func (p *PlayerCommand) Decode(r encoding.Reader) error { if _, err := r.VarInt(&p.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/playerInfoRemove.go b/protocol/net/packet/play/playerInfoRemove.go index f941f61c..f6a1ef6b 100644 --- a/protocol/net/packet/play/playerInfoRemove.go +++ b/protocol/net/packet/play/playerInfoRemove.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/google/uuid" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) const PacketIdPlayerInfoRemove = 0x3D @@ -17,7 +17,7 @@ func (PlayerInfoRemove) ID() int32 { return 0x3D } -func (p *PlayerInfoRemove) Encode(w io.Writer) error { +func (p *PlayerInfoRemove) Encode(w encoding.Writer) error { if err := w.VarInt(int32(len(p.UUIDs))); err != nil { return err } @@ -29,7 +29,7 @@ func (p *PlayerInfoRemove) Encode(w io.Writer) error { return nil } -func (p *PlayerInfoRemove) Decode(r io.Reader) error { +func (p *PlayerInfoRemove) Decode(r encoding.Reader) error { var length int32 if _, err := r.VarInt(&length); err != nil { return err diff --git a/protocol/net/packet/play/playerInfoUpdate.go b/protocol/net/packet/play/playerInfoUpdate.go index afb90f5d..66a364d2 100644 --- a/protocol/net/packet/play/playerInfoUpdate.go +++ b/protocol/net/packet/play/playerInfoUpdate.go @@ -2,7 +2,7 @@ package play import ( "github.com/google/uuid" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/packet/login" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -46,7 +46,7 @@ func (PlayerInfoUpdate) ID() int32 { return 0x3E } -func (p *PlayerInfoUpdate) Encode(w io.Writer) error { +func (p *PlayerInfoUpdate) Encode(w encoding.Writer) error { if err := w.Byte(p.Actions); err != nil { return err } @@ -125,6 +125,6 @@ func (p *PlayerInfoUpdate) Encode(w io.Writer) error { return nil } -func (p *PlayerInfoUpdate) Decode(r io.Reader) error { +func (p *PlayerInfoUpdate) Decode(r encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/play/playerSession.go b/protocol/net/packet/play/playerSession.go index 0dc13ca7..0e568303 100644 --- a/protocol/net/packet/play/playerSession.go +++ b/protocol/net/packet/play/playerSession.go @@ -2,7 +2,7 @@ package play import ( "github.com/google/uuid" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) // serverbound @@ -19,7 +19,7 @@ func (PlayerSession) ID() int32 { return 0x07 } -func (p *PlayerSession) Encode(w io.Writer) error { +func (p *PlayerSession) Encode(w encoding.Writer) error { if err := w.UUID(p.SessionID); err != nil { return err } @@ -32,7 +32,7 @@ func (p *PlayerSession) Encode(w io.Writer) error { return w.ByteArray(p.KeySignature) } -func (p *PlayerSession) Decode(r io.Reader) error { +func (p *PlayerSession) Decode(r encoding.Reader) error { if err := r.UUID(&p.SessionID); err != nil { return err } diff --git a/protocol/net/packet/play/plugin.go b/protocol/net/packet/play/plugin.go index f18a82ca..c8dcd271 100644 --- a/protocol/net/packet/play/plugin.go +++ b/protocol/net/packet/play/plugin.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/packet/configuration" ) @@ -14,14 +14,14 @@ func (ClientboundPluginMessage) ID() int32 { return 0x19 } -func (c *ClientboundPluginMessage) Encode(w io.Writer) error { +func (c *ClientboundPluginMessage) Encode(w encoding.Writer) error { if err := w.Identifier(c.Channel); err != nil { return err } return w.FixedByteArray(c.Data) } -func (c *ClientboundPluginMessage) Decode(r io.Reader) error { +func (c *ClientboundPluginMessage) Decode(r encoding.Reader) error { if err := r.Identifier(&c.Channel); err != nil { return err } diff --git a/protocol/net/packet/play/removeEntities.go b/protocol/net/packet/play/removeEntities.go index 9fe813cc..3ff66f51 100644 --- a/protocol/net/packet/play/removeEntities.go +++ b/protocol/net/packet/play/removeEntities.go @@ -1,8 +1,10 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) -//clientbound +// clientbound const PacketIdRemoveEntities = 0x42 type RemoveEntities struct { @@ -13,7 +15,7 @@ func (RemoveEntities) ID() int32 { return PacketIdRemoveEntities } -func (r *RemoveEntities) Encode(w io.Writer) error { +func (r *RemoveEntities) Encode(w encoding.Writer) error { if err := w.VarInt(int32(len(r.EntityIDs))); err != nil { return err } @@ -27,7 +29,7 @@ func (r *RemoveEntities) Encode(w io.Writer) error { return nil } -func (e *RemoveEntities) Decode(r io.Reader) error { +func (e *RemoveEntities) Decode(r encoding.Reader) error { var length int32 if _, err := r.VarInt(&length); err != nil { return err diff --git a/protocol/net/packet/play/serverData.go b/protocol/net/packet/play/serverData.go index bc694313..1ace8ab8 100644 --- a/protocol/net/packet/play/serverData.go +++ b/protocol/net/packet/play/serverData.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -17,7 +17,7 @@ func (ServerData) ID() int32 { return PacketIdServerData } -func (d *ServerData) Encode(w io.Writer) error { +func (d *ServerData) Encode(w encoding.Writer) error { if err := w.TextComponent(d.MOTD); err != nil { return err } @@ -30,7 +30,7 @@ func (d *ServerData) Encode(w io.Writer) error { return nil } -func (d *ServerData) Decode(r io.Reader) error { +func (d *ServerData) Decode(r encoding.Reader) error { if err := r.TextComponent(&d.MOTD); err != nil { return err } diff --git a/protocol/net/packet/play/serverLinks.go b/protocol/net/packet/play/serverLinks.go index 25e9b0e4..0c211ba1 100644 --- a/protocol/net/packet/play/serverLinks.go +++ b/protocol/net/packet/play/serverLinks.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -38,7 +38,7 @@ func (ServerLinks) ID() int32 { return PacketIdServerLinks } -func (s *ServerLinks) Encode(w io.Writer) error { +func (s *ServerLinks) Encode(w encoding.Writer) error { if err := w.VarInt(int32(len(s.Links))); err != nil { return err } @@ -62,6 +62,6 @@ func (s *ServerLinks) Encode(w io.Writer) error { return nil } -func (s *ServerLinks) Decode(r io.Reader) error { +func (s *ServerLinks) Decode(r encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/play/setCenterChunk.go b/protocol/net/packet/play/setCenterChunk.go index a73b1f42..f57f9343 100644 --- a/protocol/net/packet/play/setCenterChunk.go +++ b/protocol/net/packet/play/setCenterChunk.go @@ -1,8 +1,10 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) -//clientbound +// clientbound const PacketIdSetCenterChunk = 0x54 type SetCenterChunk struct { @@ -13,14 +15,14 @@ func (SetCenterChunk) ID() int32 { return 0x54 } -func (s *SetCenterChunk) Encode(w io.Writer) error { +func (s *SetCenterChunk) Encode(w encoding.Writer) error { if err := w.VarInt(s.ChunkX); err != nil { return err } return w.VarInt(s.ChunkZ) } -func (s *SetCenterChunk) Decode(r io.Reader) error { +func (s *SetCenterChunk) Decode(r encoding.Reader) error { if _, err := r.VarInt(&s.ChunkX); err != nil { return err } diff --git a/protocol/net/packet/play/setContainerContent.go b/protocol/net/packet/play/setContainerContent.go index db43c582..c38de25a 100644 --- a/protocol/net/packet/play/setContainerContent.go +++ b/protocol/net/packet/play/setContainerContent.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/slot" ) @@ -19,7 +19,7 @@ func (SetContainerContent) ID() int32 { return PacketIdSetContainerContent } -func (s *SetContainerContent) Encode(w io.Writer) error { +func (s *SetContainerContent) Encode(w encoding.Writer) error { if err := w.Ubyte(s.WindowID); err != nil { return err } @@ -38,6 +38,6 @@ func (s *SetContainerContent) Encode(w io.Writer) error { return s.CarriedItem.Encode(w) } -func (s *SetContainerContent) Decode(r io.Reader) error { +func (s *SetContainerContent) Decode(r encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/play/setCreativeModeSlot.go b/protocol/net/packet/play/setCreativeModeSlot.go index eb5a48df..4aa37135 100644 --- a/protocol/net/packet/play/setCreativeModeSlot.go +++ b/protocol/net/packet/play/setCreativeModeSlot.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/slot" ) @@ -17,14 +17,14 @@ func (SetCreativeModeSlot) ID() int32 { return PacketIdSetCreativeModeSlot } -func (s *SetCreativeModeSlot) Encode(w io.Writer) error { +func (s *SetCreativeModeSlot) Encode(w encoding.Writer) error { if err := w.Short(s.Slot); err != nil { return err } return s.ClickedItem.Encode(w) } -func (s *SetCreativeModeSlot) Decode(r io.Reader) error { +func (s *SetCreativeModeSlot) Decode(r encoding.Reader) error { if err := r.Short(&s.Slot); err != nil { return err } diff --git a/protocol/net/packet/play/setDefaultSpawnPosition.go b/protocol/net/packet/play/setDefaultSpawnPosition.go index ad5c9217..f998b96d 100644 --- a/protocol/net/packet/play/setDefaultSpawnPosition.go +++ b/protocol/net/packet/play/setDefaultSpawnPosition.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdSetDefaultSpawnPosition = 0x56 @@ -14,14 +16,14 @@ func (SetDefaultSpawnPosition) ID() int32 { return PacketIdSetDefaultSpawnPosition } -func (s *SetDefaultSpawnPosition) Encode(w io.Writer) error { +func (s *SetDefaultSpawnPosition) Encode(w encoding.Writer) error { if err := w.Position(s.X, s.Y, s.Z); err != nil { return err } return w.Float(s.Angle) } -func (s *SetDefaultSpawnPosition) Decode(r io.Reader) error { +func (s *SetDefaultSpawnPosition) Decode(r encoding.Reader) error { if err := r.Position(&s.X, &s.Y, &s.Z); err != nil { return err } diff --git a/protocol/net/packet/play/setEntityMetadata.go b/protocol/net/packet/play/setEntityMetadata.go index bfd967b1..21423cd8 100644 --- a/protocol/net/packet/play/setEntityMetadata.go +++ b/protocol/net/packet/play/setEntityMetadata.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/metadata" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -18,7 +18,7 @@ func (SetEntityMetadata) ID() int32 { return PacketIdSetEntityMetadata } -func (s *SetEntityMetadata) Encode(w io.Writer) error { +func (s *SetEntityMetadata) Encode(w encoding.Writer) error { if err := w.VarInt(s.EntityId); err != nil { return err } @@ -273,6 +273,6 @@ func (s *SetEntityMetadata) Encode(w io.Writer) error { return w.Ubyte(0xFF) } -func (*SetEntityMetadata) Decode(r io.Reader) error { +func (*SetEntityMetadata) Decode(r encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/play/setEntityVelocity.go b/protocol/net/packet/play/setEntityVelocity.go index 0a5ed9a4..5ed0a884 100644 --- a/protocol/net/packet/play/setEntityVelocity.go +++ b/protocol/net/packet/play/setEntityVelocity.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdSetEntityVelocity = 0x5A @@ -14,7 +16,7 @@ func (SetEntityVelocity) ID() int32 { return PacketIdSetEntityVelocity } -func (d *SetEntityVelocity) Encode(w io.Writer) error { +func (d *SetEntityVelocity) Encode(w encoding.Writer) error { if err := w.VarInt(d.EntityId); err != nil { return err } @@ -27,7 +29,7 @@ func (d *SetEntityVelocity) Encode(w io.Writer) error { return w.Short(d.Z) } -func (d *SetEntityVelocity) Decode(r io.Reader) error { +func (d *SetEntityVelocity) Decode(r encoding.Reader) error { if _, err := r.VarInt(&d.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/setHeadRotation.go b/protocol/net/packet/play/setHeadRotation.go index b71b281c..2810e04c 100644 --- a/protocol/net/packet/play/setHeadRotation.go +++ b/protocol/net/packet/play/setHeadRotation.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdSetHeadRotation = 0x48 @@ -14,14 +16,14 @@ func (SetHeadRotation) ID() int32 { return PacketIdSetHeadRotation } -func (s *SetHeadRotation) Encode(w io.Writer) error { +func (s *SetHeadRotation) Encode(w encoding.Writer) error { if err := w.VarInt(s.EntityId); err != nil { return err } return w.Ubyte(s.HeadYaw) } -func (s *SetHeadRotation) Decode(r io.Reader) error { +func (s *SetHeadRotation) Decode(r encoding.Reader) error { if _, err := r.VarInt(&s.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/setHeldItemCB.go b/protocol/net/packet/play/setHeldItemCB.go index d32ecef3..4683d9be 100644 --- a/protocol/net/packet/play/setHeldItemCB.go +++ b/protocol/net/packet/play/setHeldItemCB.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdSetHeldItemClientbound = 0x53 @@ -13,10 +15,10 @@ func (SetHeldItemClientbound) ID() int32 { return PacketIdSetHeldItemClientbound } -func (s *SetHeldItemClientbound) Encode(w io.Writer) error { +func (s *SetHeldItemClientbound) Encode(w encoding.Writer) error { return w.Byte(s.Slot) } -func (s *SetHeldItemClientbound) Decode(r io.Reader) error { +func (s *SetHeldItemClientbound) Decode(r encoding.Reader) error { return r.Byte(&s.Slot) } diff --git a/protocol/net/packet/play/setHeldItemSB.go b/protocol/net/packet/play/setHeldItemSB.go index 39fc5bf8..24b9412e 100644 --- a/protocol/net/packet/play/setHeldItemSB.go +++ b/protocol/net/packet/play/setHeldItemSB.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdSetHeldItemServerbound = 0x2F @@ -13,10 +15,10 @@ func (SetHeldItemServerbound) ID() int32 { return PacketIdSetHeldItemServerbound } -func (s *SetHeldItemServerbound) Encode(w io.Writer) error { +func (s *SetHeldItemServerbound) Encode(w encoding.Writer) error { return w.Short(s.Slot) } -func (s *SetHeldItemServerbound) Decode(r io.Reader) error { +func (s *SetHeldItemServerbound) Decode(r encoding.Reader) error { return r.Short(&s.Slot) } diff --git a/protocol/net/packet/play/setPlayerOnGround.go b/protocol/net/packet/play/setPlayerOnGround.go index a44464ac..d4a64ebd 100644 --- a/protocol/net/packet/play/setPlayerOnGround.go +++ b/protocol/net/packet/play/setPlayerOnGround.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdSetPlayerOnGround = 0x1D @@ -13,10 +15,10 @@ func (SetPlayerOnGround) ID() int32 { return PacketIdSetPlayerOnGround } -func (s *SetPlayerOnGround) Encode(w io.Writer) error { +func (s *SetPlayerOnGround) Encode(w encoding.Writer) error { return w.Bool(s.OnGround) } -func (s *SetPlayerOnGround) Decode(r io.Reader) error { +func (s *SetPlayerOnGround) Decode(r encoding.Reader) error { return r.Bool(&s.OnGround) } diff --git a/protocol/net/packet/play/setPlayerPosition.go b/protocol/net/packet/play/setPlayerPosition.go index cc4ddca2..614c4a10 100644 --- a/protocol/net/packet/play/setPlayerPosition.go +++ b/protocol/net/packet/play/setPlayerPosition.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdSetPlayerPosition = 0x1A @@ -14,7 +16,7 @@ func (SetPlayerPosition) ID() int32 { return 0x1A } -func (s *SetPlayerPosition) Encode(w io.Writer) error { +func (s *SetPlayerPosition) Encode(w encoding.Writer) error { if err := w.Double(s.X); err != nil { return err } @@ -27,7 +29,7 @@ func (s *SetPlayerPosition) Encode(w io.Writer) error { return w.Bool(s.OnGround) } -func (s *SetPlayerPosition) Decode(r io.Reader) error { +func (s *SetPlayerPosition) Decode(r encoding.Reader) error { if err := r.Double(&s.X); err != nil { return err } diff --git a/protocol/net/packet/play/setPlayerPositionAndRotation.go b/protocol/net/packet/play/setPlayerPositionAndRotation.go index 7f2c8803..5f80334d 100644 --- a/protocol/net/packet/play/setPlayerPositionAndRotation.go +++ b/protocol/net/packet/play/setPlayerPositionAndRotation.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdSetPlayerPositionAndRotation = 0x1B @@ -15,7 +17,7 @@ func (SetPlayerPositionAndRotation) ID() int32 { return 0x1B } -func (s *SetPlayerPositionAndRotation) Encode(w io.Writer) error { +func (s *SetPlayerPositionAndRotation) Encode(w encoding.Writer) error { if err := w.Double(s.X); err != nil { return err } @@ -34,7 +36,7 @@ func (s *SetPlayerPositionAndRotation) Encode(w io.Writer) error { return w.Bool(s.OnGround) } -func (s *SetPlayerPositionAndRotation) Decode(r io.Reader) error { +func (s *SetPlayerPositionAndRotation) Decode(r encoding.Reader) error { if err := r.Double(&s.X); err != nil { return err } diff --git a/protocol/net/packet/play/setPlayerRotation.go b/protocol/net/packet/play/setPlayerRotation.go index f5c77cb9..09433881 100644 --- a/protocol/net/packet/play/setPlayerRotation.go +++ b/protocol/net/packet/play/setPlayerRotation.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdSetPlayerRotation = 0x1C @@ -14,7 +16,7 @@ func (SetPlayerRotation) ID() int32 { return 0x1C } -func (s *SetPlayerRotation) Encode(w io.Writer) error { +func (s *SetPlayerRotation) Encode(w encoding.Writer) error { if err := w.Float(s.Yaw); err != nil { return err } @@ -24,7 +26,7 @@ func (s *SetPlayerRotation) Encode(w io.Writer) error { return w.Bool(s.OnGround) } -func (s *SetPlayerRotation) Decode(r io.Reader) error { +func (s *SetPlayerRotation) Decode(r encoding.Reader) error { if err := r.Float(&s.Yaw); err != nil { return err } diff --git a/protocol/net/packet/play/setTickingState.go b/protocol/net/packet/play/setTickingState.go index cbc5dce4..29c02fb4 100644 --- a/protocol/net/packet/play/setTickingState.go +++ b/protocol/net/packet/play/setTickingState.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdSetTickingState = 0x71 @@ -14,16 +16,9 @@ func (SetTickingState) ID() int32 { return PacketIdSetTickingState } -func (s *SetTickingState) Encode(w io.Writer) error { +func (s *SetTickingState) Encode(w encoding.Writer) error { if err := w.Float(s.TickRate); err != nil { return err } return w.Bool(s.IsFrozen) } - -func (s *SetTickingState) Decode(r io.Reader) error { - if err := r.Float(&s.TickRate); err != nil { - return err - } - return r.Bool(&s.IsFrozen) -} diff --git a/protocol/net/packet/play/signedChatCommand.go b/protocol/net/packet/play/signedChatCommand.go index bffdabb7..cafa3400 100644 --- a/protocol/net/packet/play/signedChatCommand.go +++ b/protocol/net/packet/play/signedChatCommand.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdSignedChatCommand = 0x05 @@ -10,7 +12,7 @@ type SignedChatCommand struct { Timestamp, Salt int64 Arguments []SignedArgument MessageCount int32 - Acknowledged io.FixedBitSet + Acknowledged encoding.FixedBitSet } type SignedArgument struct { @@ -22,7 +24,7 @@ func (SignedChatCommand) ID() int32 { return PacketIdChatCommand } -func (c *SignedChatCommand) Encode(w io.Writer) error { +func (c *SignedChatCommand) Encode(w encoding.Writer) error { if err := w.String(c.Command); err != nil { return err } @@ -49,7 +51,7 @@ func (c *SignedChatCommand) Encode(w io.Writer) error { return w.FixedBitSet(c.Acknowledged) } -func (c *SignedChatCommand) Decode(r io.Reader) error { +func (c *SignedChatCommand) Decode(r encoding.Reader) error { if err := r.String(&c.Command); err != nil { return err } diff --git a/protocol/net/packet/play/soundEffect.go b/protocol/net/packet/play/soundEffect.go index 5554db82..672ba3f5 100644 --- a/protocol/net/packet/play/soundEffect.go +++ b/protocol/net/packet/play/soundEffect.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdSoundEffect = 0x68 @@ -34,7 +36,7 @@ func (SoundEffect) ID() int32 { return PacketIdSoundEffect } -func (s *SoundEffect) Encode(w io.Writer) error { +func (s *SoundEffect) Encode(w encoding.Writer) error { if err := w.VarInt(s.SoundId + 1); err != nil { return err } @@ -72,6 +74,6 @@ func (s *SoundEffect) Encode(w io.Writer) error { return w.Long(s.Seed) } -func (s *SoundEffect) Decode(r io.Reader) error { +func (s *SoundEffect) Decode(r encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/play/spawnEntity.go b/protocol/net/packet/play/spawnEntity.go index 4c933037..c5deaaa1 100644 --- a/protocol/net/packet/play/spawnEntity.go +++ b/protocol/net/packet/play/spawnEntity.go @@ -2,7 +2,7 @@ package play import ( "github.com/google/uuid" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) const ( @@ -31,7 +31,7 @@ func (SpawnEntity) ID() int32 { return 0x01 } -func (s *SpawnEntity) Encode(w io.Writer) error { +func (s *SpawnEntity) Encode(w encoding.Writer) error { if err := w.VarInt(s.EntityId); err != nil { return err } @@ -71,7 +71,7 @@ func (s *SpawnEntity) Encode(w io.Writer) error { return w.Short(s.VelZ) } -func (s *SpawnEntity) Decode(r io.Reader) error { +func (s *SpawnEntity) Decode(r encoding.Reader) error { if _, err := r.VarInt(&s.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/stepTick.go b/protocol/net/packet/play/stepTick.go new file mode 100644 index 00000000..3bee8fb1 --- /dev/null +++ b/protocol/net/packet/play/stepTick.go @@ -0,0 +1,20 @@ +package play + +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) + +// clientbound +const PacketIdStepTick = 0x72 + +type StepTick struct { + TickSteps int32 +} + +func (StepTick) ID() int32 { + return PacketIdStepTick +} + +func (s *StepTick) Encode(w encoding.Writer) error { + return w.VarInt(s.TickSteps) +} diff --git a/protocol/net/packet/play/swingArm.go b/protocol/net/packet/play/swingArm.go index 64befdd9..f3edd14e 100644 --- a/protocol/net/packet/play/swingArm.go +++ b/protocol/net/packet/play/swingArm.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdSwingArm = 0x36 @@ -18,11 +20,11 @@ func (SwingArm) ID() int32 { return PacketIdSwingArm } -func (e *SwingArm) Encode(w io.Writer) error { +func (e *SwingArm) Encode(w encoding.Writer) error { return w.VarInt(e.Hand) } -func (e *SwingArm) Decode(r io.Reader) error { +func (e *SwingArm) Decode(r encoding.Reader) error { _, err := r.VarInt(&e.Hand) return err } diff --git a/protocol/net/packet/play/synchronizePlayerPosition.go b/protocol/net/packet/play/synchronizePlayerPosition.go index 68fc6b96..d9b054f6 100644 --- a/protocol/net/packet/play/synchronizePlayerPosition.go +++ b/protocol/net/packet/play/synchronizePlayerPosition.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" ) // serverbound @@ -26,7 +26,7 @@ func (SynchronizePlayerPosition) ID() int32 { return PacketIdSynchronizePlayerPosition } -func (s *SynchronizePlayerPosition) Encode(w io.Writer) error { +func (s *SynchronizePlayerPosition) Encode(w encoding.Writer) error { if err := w.Double(s.X); err != nil { return err } @@ -48,7 +48,7 @@ func (s *SynchronizePlayerPosition) Encode(w io.Writer) error { return w.VarInt(s.TeleportID) } -func (s *SynchronizePlayerPosition) Decode(r io.Reader) error { +func (s *SynchronizePlayerPosition) Decode(r encoding.Reader) error { if err := r.Double(&s.X); err != nil { return err } diff --git a/protocol/net/packet/play/systemChatMessage.go b/protocol/net/packet/play/systemChatMessage.go index 2b825cc0..d3feda9f 100644 --- a/protocol/net/packet/play/systemChatMessage.go +++ b/protocol/net/packet/play/systemChatMessage.go @@ -1,7 +1,7 @@ package play import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -17,14 +17,14 @@ func (SystemChatMessage) ID() int32 { return PacketIdSystemChatMessage } -func (s *SystemChatMessage) Encode(w io.Writer) error { +func (s *SystemChatMessage) Encode(w encoding.Writer) error { if err := w.TextComponent(s.Content); err != nil { return err } return w.Bool(s.Overlay) } -func (s *SystemChatMessage) Decode(r io.Reader) error { +func (s *SystemChatMessage) Decode(r encoding.Reader) error { if err := r.TextComponent(&s.Content); err != nil { return err } diff --git a/protocol/net/packet/play/updateEntityPosition.go b/protocol/net/packet/play/updateEntityPosition.go index 4079555c..05942cda 100644 --- a/protocol/net/packet/play/updateEntityPosition.go +++ b/protocol/net/packet/play/updateEntityPosition.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdUpdateEntityPosition = 0x2E @@ -15,7 +17,7 @@ func (UpdateEntityPosition) ID() int32 { return PacketIdUpdateEntityPosition } -func (s *UpdateEntityPosition) Encode(w io.Writer) error { +func (s *UpdateEntityPosition) Encode(w encoding.Writer) error { if err := w.VarInt(s.EntityId); err != nil { return err } @@ -31,7 +33,7 @@ func (s *UpdateEntityPosition) Encode(w io.Writer) error { return w.Bool(s.OnGround) } -func (s *UpdateEntityPosition) Decode(r io.Reader) error { +func (s *UpdateEntityPosition) Decode(r encoding.Reader) error { if _, err := r.VarInt(&s.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/updateEntityPositionAndRotation.go b/protocol/net/packet/play/updateEntityPositionAndRotation.go index 6aea099f..21720028 100644 --- a/protocol/net/packet/play/updateEntityPositionAndRotation.go +++ b/protocol/net/packet/play/updateEntityPositionAndRotation.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdUpdateEntityPositionAndRotation = 0x2F @@ -16,7 +18,7 @@ func (UpdateEntityPositionAndRotation) ID() int32 { return PacketIdUpdateEntityPositionAndRotation } -func (s *UpdateEntityPositionAndRotation) Encode(w io.Writer) error { +func (s *UpdateEntityPositionAndRotation) Encode(w encoding.Writer) error { if err := w.VarInt(s.EntityId); err != nil { return err } @@ -38,7 +40,7 @@ func (s *UpdateEntityPositionAndRotation) Encode(w io.Writer) error { return w.Bool(s.OnGround) } -func (s *UpdateEntityPositionAndRotation) Decode(r io.Reader) error { +func (s *UpdateEntityPositionAndRotation) Decode(r encoding.Reader) error { if _, err := r.VarInt(&s.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/updateEntityRotation.go b/protocol/net/packet/play/updateEntityRotation.go index ff4fdbf0..c08c9128 100644 --- a/protocol/net/packet/play/updateEntityRotation.go +++ b/protocol/net/packet/play/updateEntityRotation.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdUpdateEntityRotation = 0x30 @@ -15,7 +17,7 @@ func (UpdateEntityRotation) ID() int32 { return PacketIdUpdateEntityRotation } -func (s *UpdateEntityRotation) Encode(w io.Writer) error { +func (s *UpdateEntityRotation) Encode(w encoding.Writer) error { if err := w.VarInt(s.EntityId); err != nil { return err } @@ -28,7 +30,7 @@ func (s *UpdateEntityRotation) Encode(w io.Writer) error { return w.Bool(s.OnGround) } -func (s *UpdateEntityRotation) Decode(r io.Reader) error { +func (s *UpdateEntityRotation) Decode(r encoding.Reader) error { if _, err := r.VarInt(&s.EntityId); err != nil { return err } diff --git a/protocol/net/packet/play/updateRecipeBook.go b/protocol/net/packet/play/updateRecipeBook.go index d46daa5e..8f9e0944 100644 --- a/protocol/net/packet/play/updateRecipeBook.go +++ b/protocol/net/packet/play/updateRecipeBook.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) const ( UpdateRecipeBookActionInit = iota @@ -34,7 +36,7 @@ func (UpdateRecipeBook) ID() int32 { return PacketIdUpdateRecipeBook } -func (u *UpdateRecipeBook) Encode(w io.Writer) error { +func (u *UpdateRecipeBook) Encode(w encoding.Writer) error { if err := w.VarInt(u.Action); err != nil { return err } @@ -88,6 +90,6 @@ func (u *UpdateRecipeBook) Encode(w io.Writer) error { return nil } -func (*UpdateRecipeBook) Decode(io.Reader) error { +func (*UpdateRecipeBook) Decode(encoding.Reader) error { return nil //TODO } diff --git a/protocol/net/packet/play/updateSectionBlocks.go b/protocol/net/packet/play/updateSectionBlocks.go index 1910c8bf..274c9df1 100644 --- a/protocol/net/packet/play/updateSectionBlocks.go +++ b/protocol/net/packet/play/updateSectionBlocks.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdUpdateSectionBlocks = 0x49 @@ -16,7 +18,7 @@ func (UpdateSectionBlocks) ID() int32 { return PacketIdUpdateSectionBlocks } -func (b *UpdateSectionBlocks) Encode(w io.Writer) error { +func (b *UpdateSectionBlocks) Encode(w encoding.Writer) error { if err := w.Long(((int64(b.ChunkX) & 0x3FFFFF) << 42) | (int64(b.ChunkY) & 0xFFFFF) | ((int64(b.ChunkZ) & 0x3FFFFF) << 20)); err != nil { return err } @@ -32,7 +34,7 @@ func (b *UpdateSectionBlocks) Encode(w io.Writer) error { return nil } -func (b *UpdateSectionBlocks) Decode(r io.Reader) error { +func (b *UpdateSectionBlocks) Decode(r encoding.Reader) error { var sectionPos int64 if err := r.Long(§ionPos); err != nil { return err diff --git a/protocol/net/packet/play/updateTags.go b/protocol/net/packet/play/updateTags.go index 8fbdde9b..1487d690 100644 --- a/protocol/net/packet/play/updateTags.go +++ b/protocol/net/packet/play/updateTags.go @@ -1,8 +1,10 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) -//clientbound +// clientbound const PacketIdUpdateTags = 0x78 type UpdateTags struct { @@ -13,7 +15,7 @@ func (UpdateTags) ID() int32 { return PacketIdUpdateTags } -func (u *UpdateTags) Encode(w io.Writer) error { +func (u *UpdateTags) Encode(w encoding.Writer) error { if err := w.VarInt(int32(len(u.Tags))); err != nil { return err } @@ -42,7 +44,7 @@ func (u *UpdateTags) Encode(w io.Writer) error { return nil } -func (u *UpdateTags) Decode(r io.Reader) error { +func (u *UpdateTags) Decode(r encoding.Reader) error { var length int32 if _, err := r.VarInt(&length); err != nil { return err diff --git a/protocol/net/packet/play/updateTime.go b/protocol/net/packet/play/updateTime.go index 027c813b..e5ed0b03 100644 --- a/protocol/net/packet/play/updateTime.go +++ b/protocol/net/packet/play/updateTime.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // clientbound const PacketIdUpdateTime = 0x64 @@ -14,14 +16,14 @@ func (UpdateTime) ID() int32 { return PacketIdUpdateTime } -func (u *UpdateTime) Encode(w io.Writer) error { +func (u *UpdateTime) Encode(w encoding.Writer) error { if err := w.Long(u.WorldAge); err != nil { return err } return w.Long(u.TimeOfDay) } -func (u *UpdateTime) Decode(r io.Reader) error { +func (u *UpdateTime) Decode(r encoding.Reader) error { if err := r.Long(&u.WorldAge); err != nil { return err } diff --git a/protocol/net/packet/play/useItemOn.go b/protocol/net/packet/play/useItemOn.go index ba9b860b..1729e4a1 100644 --- a/protocol/net/packet/play/useItemOn.go +++ b/protocol/net/packet/play/useItemOn.go @@ -1,6 +1,8 @@ package play -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) // serverbound const PacketIdUseItemOn = 0x38 @@ -27,7 +29,7 @@ func (UseItemOn) ID() int32 { return PacketIdUseItemOn } -func (u *UseItemOn) Encode(w io.Writer) error { +func (u *UseItemOn) Encode(w encoding.Writer) error { if err := w.VarInt(u.Hand); err != nil { return err } @@ -52,7 +54,7 @@ func (u *UseItemOn) Encode(w io.Writer) error { return w.VarInt(u.Sequence) } -func (u *UseItemOn) Decode(r io.Reader) error { +func (u *UseItemOn) Decode(r encoding.Reader) error { if _, err := r.VarInt(&u.Hand); err != nil { return err } diff --git a/protocol/net/packet/status/ping.go b/protocol/net/packet/status/ping.go index 7ad732fb..fd330213 100644 --- a/protocol/net/packet/status/ping.go +++ b/protocol/net/packet/status/ping.go @@ -1,6 +1,8 @@ package status -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) type Ping struct { Payload int64 @@ -10,10 +12,10 @@ func (Ping) ID() int32 { return 0x01 } -func (p Ping) Encode(w io.Writer) error { +func (p Ping) Encode(w encoding.Writer) error { return w.Long(p.Payload) } -func (p *Ping) Decode(r io.Reader) error { +func (p *Ping) Decode(r encoding.Reader) error { return r.Long(&p.Payload) } diff --git a/protocol/net/packet/status/status.go b/protocol/net/packet/status/status.go index 5581e53c..83a2dd8c 100644 --- a/protocol/net/packet/status/status.go +++ b/protocol/net/packet/status/status.go @@ -4,7 +4,7 @@ import ( "encoding/base64" "encoding/json" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) @@ -28,16 +28,16 @@ func (f Favicon) MarshalJSON() ([]byte, error) { if len(f) == 0 { return []byte{'"', '"'}, nil } - data := []byte(`"data:image/png;base64,`) - l0 := len(data) - l1 := base64.StdEncoding.EncodedLen(len(f)) - data = append(data, make([]byte, l1)...) - base64.StdEncoding.Encode(data[l0:], f) - data = append(data, '"') + data := make([]byte, len(dimgpnb64txt)+base64.StdEncoding.EncodedLen(len(f))+1) + copy(data, []byte(dimgpnb64txt)) + base64.StdEncoding.Encode(data[len(dimgpnb64txt):], f) + data[len(data)-1] = '"' return data, nil } +const dimgpnb64txt = `"data:image/png;base64,` + type StatusResponseData struct { Version StatusVersion `json:"version"` Players StatusPlayers `json:"players"` @@ -54,7 +54,7 @@ func (StatusResponse) ID() int32 { return 0x00 } -func (s StatusResponse) Encode(w io.Writer) error { +func (s StatusResponse) Encode(w encoding.Writer) error { data, err := json.Marshal(s.Data) if err != nil { return err @@ -62,7 +62,7 @@ func (s StatusResponse) Encode(w io.Writer) error { return w.ByteArray(data) } -func (s *StatusResponse) Decode(r io.Reader) error { +func (s *StatusResponse) Decode(r encoding.Reader) error { var data []byte if err := r.ByteArray(&data); err != nil { return err @@ -77,10 +77,10 @@ func (StatusRequest) ID() int32 { return 0x00 } -func (StatusRequest) Encode(io.Writer) error { +func (StatusRequest) Encode(encoding.Writer) error { return nil } -func (StatusRequest) Decode(r io.Reader) error { +func (StatusRequest) Decode(r encoding.Reader) error { return nil } diff --git a/protocol/net/registry/embed.go b/protocol/net/registry/embed.go index 84f8574c..0602500d 100644 --- a/protocol/net/registry/embed.go +++ b/protocol/net/registry/embed.go @@ -105,11 +105,11 @@ var Registries = map[string]interface{}{"minecraft:banner_pattern": map[string]s OverworldCaves Dimension "nbt:\"minecraft:overworld_caves\"" TheEnd Dimension "nbt:\"minecraft:the_end\"" TheNether Dimension1 "nbt:\"minecraft:the_nether\"" -}{Overworld: Dimension{FixedTime: 0, AmbientLight: 0, BedWorks: true, CoordinateScale: 1, Effects: "minecraft:overworld", HasCeiling: false, HasRaids: true, HasSkylight: true, Height: 384, Infiniburn: "#minecraft:infiniburn_overworld", LogicalHeight: 384, MinY: -64, MonsterSpawnBlockLightLimit: 0, Natural: true, Ultrawarm: false, PiglinSafe: false, RespawnAnchorWorks: false, MonsterSpawnLightLevel: struct { +}{Overworld: Dimension{AmbientLight: 0, BedWorks: true, CoordinateScale: 1, Effects: "minecraft:overworld", HasCeiling: false, HasRaids: true, HasSkylight: true, Height: 384, Infiniburn: "#minecraft:infiniburn_overworld", LogicalHeight: 384, MinY: -64, MonsterSpawnBlockLightLimit: 0, Natural: true, Ultrawarm: false, PiglinSafe: false, RespawnAnchorWorks: false, MonsterSpawnLightLevel: struct { MaxInclusive int32 "nbt:\"max_inclusive\"" MinInclusive int32 "nbt:\"min_inclusive\"" Type string "nbt:\"type\"" -}{MaxInclusive: 7, MinInclusive: 0, Type: "minecraft:uniform"}}, OverworldCaves: Dimension{FixedTime: 0, AmbientLight: 0, BedWorks: true, CoordinateScale: 1, Effects: "minecraft:overworld", HasCeiling: true, HasRaids: true, HasSkylight: true, Height: 384, Infiniburn: "#minecraft:infiniburn_overworld", LogicalHeight: 384, MinY: -64, MonsterSpawnBlockLightLimit: 0, Natural: true, Ultrawarm: false, PiglinSafe: false, RespawnAnchorWorks: false, MonsterSpawnLightLevel: struct { +}{MaxInclusive: 7, MinInclusive: 0, Type: "minecraft:uniform"}}, OverworldCaves: Dimension{AmbientLight: 0, BedWorks: true, CoordinateScale: 1, Effects: "minecraft:overworld", HasCeiling: true, HasRaids: true, HasSkylight: true, Height: 384, Infiniburn: "#minecraft:infiniburn_overworld", LogicalHeight: 384, MinY: -64, MonsterSpawnBlockLightLimit: 0, Natural: true, Ultrawarm: false, PiglinSafe: false, RespawnAnchorWorks: false, MonsterSpawnLightLevel: struct { MaxInclusive int32 "nbt:\"max_inclusive\"" MinInclusive int32 "nbt:\"min_inclusive\"" Type string "nbt:\"type\"" diff --git a/protocol/net/registry/embed.go.txt b/protocol/net/registry/embed.go.txt deleted file mode 100644 index b5156b41..00000000 --- a/protocol/net/registry/embed.go.txt +++ /dev/null @@ -1,2182 +0,0 @@ -package registry - -// DO NOT TOUCH! - -var _Registries = registries{BannerPattern: map[string]struct { - AssetId string "nbt:\"asset_id\"" - TranslationKey string "nbt:\"translation_key\"" -}{"minecraft:base": {AssetId: "minecraft:base", TranslationKey: "block.minecraft.banner.base"}, "minecraft:border": {AssetId: "minecraft:border", TranslationKey: "block.minecraft.banner.border"}, "minecraft:bricks": {AssetId: "minecraft:bricks", TranslationKey: "block.minecraft.banner.bricks"}, "minecraft:circle": {AssetId: "minecraft:circle", TranslationKey: "block.minecraft.banner.circle"}, "minecraft:creeper": {AssetId: "minecraft:creeper", TranslationKey: "block.minecraft.banner.creeper"}, "minecraft:cross": {AssetId: "minecraft:cross", TranslationKey: "block.minecraft.banner.cross"}, "minecraft:curly_border": {AssetId: "minecraft:curly_border", TranslationKey: "block.minecraft.banner.curly_border"}, "minecraft:diagonal_left": {AssetId: "minecraft:diagonal_left", TranslationKey: "block.minecraft.banner.diagonal_left"}, "minecraft:diagonal_right": {AssetId: "minecraft:diagonal_right", TranslationKey: "block.minecraft.banner.diagonal_right"}, "minecraft:diagonal_up_left": {AssetId: "minecraft:diagonal_up_left", TranslationKey: "block.minecraft.banner.diagonal_up_left"}, "minecraft:diagonal_up_right": {AssetId: "minecraft:diagonal_up_right", TranslationKey: "block.minecraft.banner.diagonal_up_right"}, "minecraft:flow": {AssetId: "minecraft:flow", TranslationKey: "block.minecraft.banner.flow"}, "minecraft:flower": {AssetId: "minecraft:flower", TranslationKey: "block.minecraft.banner.flower"}, "minecraft:globe": {AssetId: "minecraft:globe", TranslationKey: "block.minecraft.banner.globe"}, "minecraft:gradient": {AssetId: "minecraft:gradient", TranslationKey: "block.minecraft.banner.gradient"}, "minecraft:gradient_up": {AssetId: "minecraft:gradient_up", TranslationKey: "block.minecraft.banner.gradient_up"}, "minecraft:guster": {AssetId: "minecraft:guster", TranslationKey: "block.minecraft.banner.guster"}, "minecraft:half_horizontal": {AssetId: "minecraft:half_horizontal", TranslationKey: "block.minecraft.banner.half_horizontal"}, "minecraft:half_horizontal_bottom": {AssetId: "minecraft:half_horizontal_bottom", TranslationKey: "block.minecraft.banner.half_horizontal_bottom"}, "minecraft:half_vertical": {AssetId: "minecraft:half_vertical", TranslationKey: "block.minecraft.banner.half_vertical"}, "minecraft:half_vertical_right": {AssetId: "minecraft:half_vertical_right", TranslationKey: "block.minecraft.banner.half_vertical_right"}, "minecraft:mojang": {AssetId: "minecraft:mojang", TranslationKey: "block.minecraft.banner.mojang"}, "minecraft:piglin": {AssetId: "minecraft:piglin", TranslationKey: "block.minecraft.banner.piglin"}, "minecraft:rhombus": {AssetId: "minecraft:rhombus", TranslationKey: "block.minecraft.banner.rhombus"}, "minecraft:skull": {AssetId: "minecraft:skull", TranslationKey: "block.minecraft.banner.skull"}, "minecraft:small_stripes": {AssetId: "minecraft:small_stripes", TranslationKey: "block.minecraft.banner.small_stripes"}, "minecraft:square_bottom_left": {AssetId: "minecraft:square_bottom_left", TranslationKey: "block.minecraft.banner.square_bottom_left"}, "minecraft:square_bottom_right": {AssetId: "minecraft:square_bottom_right", TranslationKey: "block.minecraft.banner.square_bottom_right"}, "minecraft:square_top_left": {AssetId: "minecraft:square_top_left", TranslationKey: "block.minecraft.banner.square_top_left"}, "minecraft:square_top_right": {AssetId: "minecraft:square_top_right", TranslationKey: "block.minecraft.banner.square_top_right"}, "minecraft:straight_cross": {AssetId: "minecraft:straight_cross", TranslationKey: "block.minecraft.banner.straight_cross"}, "minecraft:stripe_bottom": {AssetId: "minecraft:stripe_bottom", TranslationKey: "block.minecraft.banner.stripe_bottom"}, "minecraft:stripe_center": {AssetId: "minecraft:stripe_center", TranslationKey: "block.minecraft.banner.stripe_center"}, "minecraft:stripe_downleft": {AssetId: "minecraft:stripe_downleft", TranslationKey: "block.minecraft.banner.stripe_downleft"}, "minecraft:stripe_downright": {AssetId: "minecraft:stripe_downright", TranslationKey: "block.minecraft.banner.stripe_downright"}, "minecraft:stripe_left": {AssetId: "minecraft:stripe_left", TranslationKey: "block.minecraft.banner.stripe_left"}, "minecraft:stripe_middle": {AssetId: "minecraft:stripe_middle", TranslationKey: "block.minecraft.banner.stripe_middle"}, "minecraft:stripe_right": {AssetId: "minecraft:stripe_right", TranslationKey: "block.minecraft.banner.stripe_right"}, "minecraft:stripe_top": {AssetId: "minecraft:stripe_top", TranslationKey: "block.minecraft.banner.stripe_top"}, "minecraft:triangle_bottom": {AssetId: "minecraft:triangle_bottom", TranslationKey: "block.minecraft.banner.triangle_bottom"}, "minecraft:triangle_top": {AssetId: "minecraft:triangle_top", TranslationKey: "block.minecraft.banner.triangle_top"}, "minecraft:triangles_bottom": {AssetId: "minecraft:triangles_bottom", TranslationKey: "block.minecraft.banner.triangles_bottom"}, "minecraft:triangles_top": {AssetId: "minecraft:triangles_top", TranslationKey: "block.minecraft.banner.triangles_top"}}, ChatType: map[string]ChatType{"minecraft:chat": {Chat: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" - Style struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" - } "nbt:\"style,omitempty\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "chat.type.text", Style: struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" -}{Color: "", Italic: false}}, Narration: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "chat.type.text.narrate"}}, "minecraft:emote_command": {Chat: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" - Style struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" - } "nbt:\"style,omitempty\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "chat.type.emote", Style: struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" -}{Color: "", Italic: false}}, Narration: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "chat.type.emote"}}, "minecraft:msg_command_incoming": {Chat: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" - Style struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" - } "nbt:\"style,omitempty\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "commands.message.display.incoming", Style: struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" -}{Color: "", Italic: false}}, Narration: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "chat.type.text.narrate"}}, "minecraft:msg_command_outgoing": {Chat: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" - Style struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" - } "nbt:\"style,omitempty\"" -}{Parameters: []string{"target", "content"}, TranslationKey: "commands.message.display.outgoing", Style: struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" -}{Color: "", Italic: false}}, Narration: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "chat.type.text.narrate"}}, "minecraft:say_command": {Chat: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" - Style struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" - } "nbt:\"style,omitempty\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "chat.type.announcement", Style: struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" -}{Color: "", Italic: false}}, Narration: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "chat.type.text.narrate"}}, "minecraft:team_msg_command_incoming": {Chat: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" - Style struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" - } "nbt:\"style,omitempty\"" -}{Parameters: []string{"target", "sender", "content"}, TranslationKey: "chat.type.team.text", Style: struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" -}{Color: "", Italic: false}}, Narration: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "chat.type.text.narrate"}}, "minecraft:team_msg_command_outgoing": {Chat: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" - Style struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" - } "nbt:\"style,omitempty\"" -}{Parameters: []string{"target", "sender", "content"}, TranslationKey: "chat.type.team.sent", Style: struct { - Color string "nbt:\"color\"" - Italic bool "nbt:\"italic\"" -}{Color: "", Italic: false}}, Narration: struct { - Parameters []string "nbt:\"parameters\"" - TranslationKey string "nbt:\"translation_key\"" -}{Parameters: []string{"sender", "content"}, TranslationKey: "chat.type.text.narrate"}}}, DamageType: map[string]struct { - Exhaustion float32 "nbt:\"exhaustion\"" - MessageID string "nbt:\"message_id\"" - Scaling string "nbt:\"scaling\"" - DeathMessageType string "nbt:\"death_message_type,omitempty\"" - Effects string "nbt:\"effects,omitempty\"" -}{"minecraft:arrow": {Exhaustion: 0.1, MessageID: "arrow", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:bad_respawn_point": {Exhaustion: 0.1, MessageID: "badRespawnPoint", Scaling: "always", DeathMessageType: "", Effects: ""}, "minecraft:cactus": {Exhaustion: 0.1, MessageID: "cactus", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:campfire": {Exhaustion: 0.1, MessageID: "inFire", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:cramming": {Exhaustion: 0, MessageID: "cramming", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:dragon_breath": {Exhaustion: 0, MessageID: "dragonBreath", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:drown": {Exhaustion: 0, MessageID: "drown", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:dry_out": {Exhaustion: 0.1, MessageID: "dryout", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:explosion": {Exhaustion: 0.1, MessageID: "explosion", Scaling: "always", DeathMessageType: "", Effects: ""}, "minecraft:fall": {Exhaustion: 0, MessageID: "fall", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:falling_anvil": {Exhaustion: 0.1, MessageID: "anvil", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:falling_block": {Exhaustion: 0.1, MessageID: "fallingBlock", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:falling_stalactite": {Exhaustion: 0.1, MessageID: "fallingStalactite", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:fireball": {Exhaustion: 0.1, MessageID: "fireball", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:fireworks": {Exhaustion: 0.1, MessageID: "fireworks", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:fly_into_wall": {Exhaustion: 0, MessageID: "flyIntoWall", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:freeze": {Exhaustion: 0, MessageID: "freeze", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:generic": {Exhaustion: 0, MessageID: "generic", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:generic_kill": {Exhaustion: 0, MessageID: "genericKill", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:hot_floor": {Exhaustion: 0.1, MessageID: "hotFloor", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:in_fire": {Exhaustion: 0.1, MessageID: "inFire", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:in_wall": {Exhaustion: 0, MessageID: "inWall", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:indirect_magic": {Exhaustion: 0, MessageID: "indirectMagic", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:lava": {Exhaustion: 0.1, MessageID: "lava", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:lightning_bolt": {Exhaustion: 0.1, MessageID: "lightningBolt", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:magic": {Exhaustion: 0, MessageID: "magic", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:mob_attack": {Exhaustion: 0.1, MessageID: "mob", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:mob_attack_no_aggro": {Exhaustion: 0.1, MessageID: "mob", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:mob_projectile": {Exhaustion: 0.1, MessageID: "mob", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:on_fire": {Exhaustion: 0, MessageID: "onFire", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:out_of_world": {Exhaustion: 0, MessageID: "outOfWorld", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:outside_border": {Exhaustion: 0, MessageID: "outsideBorder", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:player_attack": {Exhaustion: 0.1, MessageID: "player", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:player_explosion": {Exhaustion: 0.1, MessageID: "explosion.player", Scaling: "always", DeathMessageType: "", Effects: ""}, "minecraft:sonic_boom": {Exhaustion: 0, MessageID: "sonic_boom", Scaling: "always", DeathMessageType: "", Effects: ""}, "minecraft:spit": {Exhaustion: 0.1, MessageID: "mob", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:stalagmite": {Exhaustion: 0, MessageID: "stalagmite", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:starve": {Exhaustion: 0, MessageID: "starve", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:sting": {Exhaustion: 0.1, MessageID: "sting", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:sweet_berry_bush": {Exhaustion: 0.1, MessageID: "sweetBerryBush", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:thorns": {Exhaustion: 0.1, MessageID: "thorns", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:thrown": {Exhaustion: 0.1, MessageID: "thrown", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:trident": {Exhaustion: 0.1, MessageID: "trident", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:unattributed_fireball": {Exhaustion: 0.1, MessageID: "onFire", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:wind_charge": {Exhaustion: 0.1, MessageID: "mob", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:wither": {Exhaustion: 0, MessageID: "wither", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}, "minecraft:wither_skull": {Exhaustion: 0.1, MessageID: "witherSkull", Scaling: "when_caused_by_living_non_player", DeathMessageType: "", Effects: ""}}, DimensionType: struct { - Overworld Dimension "nbt:\"minecraft:overworld\"" - OverworldCaves Dimension "nbt:\"minecraft:overworld_caves\"" - TheEnd Dimension "nbt:\"minecraft:the_end\"" - TheNether Dimension1 "nbt:\"minecraft:the_nether\"" -}{Overworld: Dimension{FixedTime: 0, AmbientLight: 0, BedWorks: true, CoordinateScale: 1, Effects: "minecraft:overworld", HasCeiling: false, HasRaids: true, HasSkylight: true, Height: 384, Infiniburn: "#minecraft:infiniburn_overworld", LogicalHeight: 384, MinY: -64, MonsterSpawnBlockLightLimit: 0, Natural: true, Ultrawarm: false, PiglinSafe: false, RespawnAnchorWorks: false, MonsterSpawnLightLevel: struct { - MaxInclusive int32 "nbt:\"max_inclusive\"" - MinInclusive int32 "nbt:\"min_inclusive\"" - Type string "nbt:\"type\"" -}{MaxInclusive: 7, MinInclusive: 0, Type: "minecraft:uniform"}}, OverworldCaves: Dimension{FixedTime: 0, AmbientLight: 0, BedWorks: true, CoordinateScale: 1, Effects: "minecraft:overworld", HasCeiling: true, HasRaids: true, HasSkylight: true, Height: 384, Infiniburn: "#minecraft:infiniburn_overworld", LogicalHeight: 384, MinY: -64, MonsterSpawnBlockLightLimit: 0, Natural: true, Ultrawarm: false, PiglinSafe: false, RespawnAnchorWorks: false, MonsterSpawnLightLevel: struct { - MaxInclusive int32 "nbt:\"max_inclusive\"" - MinInclusive int32 "nbt:\"min_inclusive\"" - Type string "nbt:\"type\"" -}{MaxInclusive: 7, MinInclusive: 0, Type: "minecraft:uniform"}}, TheEnd: Dimension{FixedTime: 6000, AmbientLight: 0, BedWorks: false, CoordinateScale: 1, Effects: "minecraft:the_end", HasCeiling: false, HasRaids: true, HasSkylight: false, Height: 256, Infiniburn: "#minecraft:infiniburn_end", LogicalHeight: 256, MinY: 0, MonsterSpawnBlockLightLimit: 0, Natural: false, Ultrawarm: false, PiglinSafe: false, RespawnAnchorWorks: false, MonsterSpawnLightLevel: struct { - MaxInclusive int32 "nbt:\"max_inclusive\"" - MinInclusive int32 "nbt:\"min_inclusive\"" - Type string "nbt:\"type\"" -}{MaxInclusive: 7, MinInclusive: 0, Type: "minecraft:uniform"}}, TheNether: Dimension1{FixedTime: 18000, AmbientLight: 0.1, BedWorks: false, CoordinateScale: 8, Effects: "minecraft:the_nether", HasCeiling: true, HasRaids: false, HasSkylight: false, Height: 256, Infiniburn: "#minecraft:infiniburn_nether", LogicalHeight: 128, MinY: 0, MonsterSpawnBlockLightLimit: 15, Natural: false, Ultrawarm: true, PiglinSafe: true, RespawnAnchorWorks: true, MonsterSpawnLightLevel: 7}}, JukeboxSong: map[string]struct { - ComparatorOutput int32 "nbt:\"comparator_output\"" - Description struct { - Translate string "nbt:\"translate\"" - } "nbt:\"description\"" - LengthInSeconds float32 "nbt:\"length_in_seconds\"" - SoundEvent string "nbt:\"sound_event\"" -}{"minecraft:11": {ComparatorOutput: 11, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.11"}, LengthInSeconds: 71, SoundEvent: "minecraft:music_disc.11"}, "minecraft:13": {ComparatorOutput: 1, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.13"}, LengthInSeconds: 178, SoundEvent: "minecraft:music_disc.13"}, "minecraft:5": {ComparatorOutput: 15, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.5"}, LengthInSeconds: 178, SoundEvent: "minecraft:music_disc.5"}, "minecraft:blocks": {ComparatorOutput: 3, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.blocks"}, LengthInSeconds: 345, SoundEvent: "minecraft:music_disc.blocks"}, "minecraft:cat": {ComparatorOutput: 2, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.cat"}, LengthInSeconds: 185, SoundEvent: "minecraft:music_disc.cat"}, "minecraft:chirp": {ComparatorOutput: 4, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.chirp"}, LengthInSeconds: 185, SoundEvent: "minecraft:music_disc.chirp"}, "minecraft:creator": {ComparatorOutput: 12, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.creator"}, LengthInSeconds: 176, SoundEvent: "minecraft:music_disc.creator"}, "minecraft:creator_music_box": {ComparatorOutput: 11, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.creator_music_box"}, LengthInSeconds: 73, SoundEvent: "minecraft:music_disc.creator_music_box"}, "minecraft:far": {ComparatorOutput: 5, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.far"}, LengthInSeconds: 174, SoundEvent: "minecraft:music_disc.far"}, "minecraft:mall": {ComparatorOutput: 6, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.mall"}, LengthInSeconds: 197, SoundEvent: "minecraft:music_disc.mall"}, "minecraft:mellohi": {ComparatorOutput: 7, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.mellohi"}, LengthInSeconds: 96, SoundEvent: "minecraft:music_disc.mellohi"}, "minecraft:otherside": {ComparatorOutput: 14, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.otherside"}, LengthInSeconds: 195, SoundEvent: "minecraft:music_disc.otherside"}, "minecraft:pigstep": {ComparatorOutput: 13, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.pigstep"}, LengthInSeconds: 149, SoundEvent: "minecraft:music_disc.pigstep"}, "minecraft:precipice": {ComparatorOutput: 13, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.precipice"}, LengthInSeconds: 299, SoundEvent: "minecraft:music_disc.precipice"}, "minecraft:relic": {ComparatorOutput: 14, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.relic"}, LengthInSeconds: 218, SoundEvent: "minecraft:music_disc.relic"}, "minecraft:stal": {ComparatorOutput: 8, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.stal"}, LengthInSeconds: 150, SoundEvent: "minecraft:music_disc.stal"}, "minecraft:strad": {ComparatorOutput: 9, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.strad"}, LengthInSeconds: 188, SoundEvent: "minecraft:music_disc.strad"}, "minecraft:wait": {ComparatorOutput: 12, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.wait"}, LengthInSeconds: 238, SoundEvent: "minecraft:music_disc.wait"}, "minecraft:ward": {ComparatorOutput: 10, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "jukebox_song.minecraft.ward"}, LengthInSeconds: 251, SoundEvent: "minecraft:music_disc.ward"}}, PaintingVariant: map[string]struct { - AssetId string "nbt:\"asset_id\"" - Height int32 "nbt:\"height\"" - Weight int32 "nbt:\"width\"" -}{"minecraft:alban": {AssetId: "minecraft:alban", Height: 1, Weight: 1}, "minecraft:aztec": {AssetId: "minecraft:aztec", Height: 1, Weight: 1}, "minecraft:aztec2": {AssetId: "minecraft:aztec2", Height: 1, Weight: 1}, "minecraft:backyard": {AssetId: "minecraft:backyard", Height: 4, Weight: 3}, "minecraft:baroque": {AssetId: "minecraft:baroque", Height: 2, Weight: 2}, "minecraft:bomb": {AssetId: "minecraft:bomb", Height: 1, Weight: 1}, "minecraft:bouquet": {AssetId: "minecraft:bouquet", Height: 3, Weight: 3}, "minecraft:burning_skull": {AssetId: "minecraft:burning_skull", Height: 4, Weight: 4}, "minecraft:bust": {AssetId: "minecraft:bust", Height: 2, Weight: 2}, "minecraft:cavebird": {AssetId: "minecraft:cavebird", Height: 3, Weight: 3}, "minecraft:changing": {AssetId: "minecraft:changing", Height: 2, Weight: 4}, "minecraft:cotan": {AssetId: "minecraft:cotan", Height: 3, Weight: 3}, "minecraft:courbet": {AssetId: "minecraft:courbet", Height: 1, Weight: 2}, "minecraft:creebet": {AssetId: "minecraft:creebet", Height: 1, Weight: 2}, "minecraft:donkey_kong": {AssetId: "minecraft:donkey_kong", Height: 3, Weight: 4}, "minecraft:earth": {AssetId: "minecraft:earth", Height: 2, Weight: 2}, "minecraft:endboss": {AssetId: "minecraft:endboss", Height: 3, Weight: 3}, "minecraft:fern": {AssetId: "minecraft:fern", Height: 3, Weight: 3}, "minecraft:fighters": {AssetId: "minecraft:fighters", Height: 2, Weight: 4}, "minecraft:finding": {AssetId: "minecraft:finding", Height: 2, Weight: 4}, "minecraft:fire": {AssetId: "minecraft:fire", Height: 2, Weight: 2}, "minecraft:graham": {AssetId: "minecraft:graham", Height: 2, Weight: 1}, "minecraft:humble": {AssetId: "minecraft:humble", Height: 2, Weight: 2}, "minecraft:kebab": {AssetId: "minecraft:kebab", Height: 1, Weight: 1}, "minecraft:lowmist": {AssetId: "minecraft:lowmist", Height: 2, Weight: 4}, "minecraft:match": {AssetId: "minecraft:match", Height: 2, Weight: 2}, "minecraft:meditative": {AssetId: "minecraft:meditative", Height: 1, Weight: 1}, "minecraft:orb": {AssetId: "minecraft:orb", Height: 4, Weight: 4}, "minecraft:owlemons": {AssetId: "minecraft:owlemons", Height: 3, Weight: 3}, "minecraft:passage": {AssetId: "minecraft:passage", Height: 2, Weight: 4}, "minecraft:pigscene": {AssetId: "minecraft:pigscene", Height: 4, Weight: 4}, "minecraft:plant": {AssetId: "minecraft:plant", Height: 1, Weight: 1}, "minecraft:pointer": {AssetId: "minecraft:pointer", Height: 4, Weight: 4}, "minecraft:pond": {AssetId: "minecraft:pond", Height: 4, Weight: 3}, "minecraft:pool": {AssetId: "minecraft:pool", Height: 1, Weight: 2}, "minecraft:prairie_ride": {AssetId: "minecraft:prairie_ride", Height: 2, Weight: 1}, "minecraft:sea": {AssetId: "minecraft:sea", Height: 1, Weight: 2}, "minecraft:skeleton": {AssetId: "minecraft:skeleton", Height: 3, Weight: 4}, "minecraft:skull_and_roses": {AssetId: "minecraft:skull_and_roses", Height: 2, Weight: 2}, "minecraft:stage": {AssetId: "minecraft:stage", Height: 2, Weight: 2}, "minecraft:sunflowers": {AssetId: "minecraft:sunflowers", Height: 3, Weight: 3}, "minecraft:sunset": {AssetId: "minecraft:sunset", Height: 1, Weight: 2}, "minecraft:tides": {AssetId: "minecraft:tides", Height: 3, Weight: 3}, "minecraft:unpacked": {AssetId: "minecraft:unpacked", Height: 4, Weight: 4}, "minecraft:void": {AssetId: "minecraft:void", Height: 2, Weight: 2}, "minecraft:wanderer": {AssetId: "minecraft:wanderer", Height: 2, Weight: 1}, "minecraft:wasteland": {AssetId: "minecraft:wasteland", Height: 1, Weight: 1}, "minecraft:water": {AssetId: "minecraft:water", Height: 2, Weight: 2}, "minecraft:wind": {AssetId: "minecraft:wind", Height: 2, Weight: 2}, "minecraft:wither": {AssetId: "minecraft:wither", Height: 2, Weight: 2}}, TrimMaterial: map[string]struct { - AssetName string "nbt:\"asset_name\"" - Description struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" - } "nbt:\"description\"" - Ingredient string "nbt:\"ingredient\"" - ItemModelIndex float32 "nbt:\"item_model_index\"" - OverrideArmorMaterials struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" - } "nbt:\"override_armor_materials,omitempty\"" -}{"minecraft:amethyst": {AssetName: "amethyst", Description: struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" -}{Color: "#9A5CC6", Translate: "trim_material.minecraft.amethyst"}, Ingredient: "minecraft:amethyst_shard", ItemModelIndex: 1, OverrideArmorMaterials: struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" -}{Diamond: "", Gold: "", Iron: ""}}, "minecraft:copper": {AssetName: "copper", Description: struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" -}{Color: "#B4684D", Translate: "trim_material.minecraft.copper"}, Ingredient: "minecraft:copper_ingot", ItemModelIndex: 0.5, OverrideArmorMaterials: struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" -}{Diamond: "", Gold: "", Iron: ""}}, "minecraft:diamond": {AssetName: "diamond", Description: struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" -}{Color: "#6EECD2", Translate: "trim_material.minecraft.diamond"}, Ingredient: "minecraft:diamond", ItemModelIndex: 0.8, OverrideArmorMaterials: struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" -}{Diamond: "", Gold: "", Iron: ""}}, "minecraft:emerald": {AssetName: "emerald", Description: struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" -}{Color: "#11A036", Translate: "trim_material.minecraft.emerald"}, Ingredient: "minecraft:emerald", ItemModelIndex: 0.7, OverrideArmorMaterials: struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" -}{Diamond: "", Gold: "", Iron: ""}}, "minecraft:gold": {AssetName: "gold", Description: struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" -}{Color: "#DEB12D", Translate: "trim_material.minecraft.gold"}, Ingredient: "minecraft:gold_ingot", ItemModelIndex: 0.6, OverrideArmorMaterials: struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" -}{Diamond: "", Gold: "", Iron: ""}}, "minecraft:iron": {AssetName: "iron", Description: struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" -}{Color: "#ECECEC", Translate: "trim_material.minecraft.iron"}, Ingredient: "minecraft:iron_ingot", ItemModelIndex: 0.2, OverrideArmorMaterials: struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" -}{Diamond: "", Gold: "", Iron: ""}}, "minecraft:lapis": {AssetName: "lapis", Description: struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" -}{Color: "#416E97", Translate: "trim_material.minecraft.lapis"}, Ingredient: "minecraft:lapis_lazuli", ItemModelIndex: 0.9, OverrideArmorMaterials: struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" -}{Diamond: "", Gold: "", Iron: ""}}, "minecraft:netherite": {AssetName: "netherite", Description: struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" -}{Color: "#625859", Translate: "trim_material.minecraft.netherite"}, Ingredient: "minecraft:netherite_ingot", ItemModelIndex: 0.3, OverrideArmorMaterials: struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" -}{Diamond: "", Gold: "", Iron: ""}}, "minecraft:quartz": {AssetName: "quartz", Description: struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" -}{Color: "#E3D4C4", Translate: "trim_material.minecraft.quartz"}, Ingredient: "minecraft:quartz", ItemModelIndex: 0.1, OverrideArmorMaterials: struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" -}{Diamond: "", Gold: "", Iron: ""}}, "minecraft:redstone": {AssetName: "redstone", Description: struct { - Color string "nbt:\"color\"" - Translate string "nbt:\"translate\"" -}{Color: "#971607", Translate: "trim_material.minecraft.redstone"}, Ingredient: "minecraft:redstone", ItemModelIndex: 0.4, OverrideArmorMaterials: struct { - Diamond string "nbt:\"minecraft:diamond,omitempty\"" - Gold string "nbt:\"minecraft:gold,omitempty\"" - Iron string "nbt:\"minecraft:iron,omitempty\"" -}{Diamond: "", Gold: "", Iron: ""}}}, TrimPattern: map[string]struct { - AssetId string "nbt:\"asset_id\"" - Decal bool "nbt:\"decal\"" - Description struct { - Translate string "nbt:\"translate\"" - } "nbt:\"description\"" - TemplateItem string "nbt:\"template_item\"" -}{"minecraft:bolt": {AssetId: "minecraft:bolt", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.bolt"}, TemplateItem: "minecraft:bolt_armor_trim_smithing_template"}, "minecraft:coast": {AssetId: "minecraft:coast", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.coast"}, TemplateItem: "minecraft:coast_armor_trim_smithing_template"}, "minecraft:dune": {AssetId: "minecraft:dune", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.dune"}, TemplateItem: "minecraft:dune_armor_trim_smithing_template"}, "minecraft:eye": {AssetId: "minecraft:eye", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.eye"}, TemplateItem: "minecraft:eye_armor_trim_smithing_template"}, "minecraft:flow": {AssetId: "minecraft:flow", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.flow"}, TemplateItem: "minecraft:flow_armor_trim_smithing_template"}, "minecraft:host": {AssetId: "minecraft:host", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.host"}, TemplateItem: "minecraft:host_armor_trim_smithing_template"}, "minecraft:raiser": {AssetId: "minecraft:raiser", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.raiser"}, TemplateItem: "minecraft:raiser_armor_trim_smithing_template"}, "minecraft:rib": {AssetId: "minecraft:rib", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.rib"}, TemplateItem: "minecraft:rib_armor_trim_smithing_template"}, "minecraft:sentry": {AssetId: "minecraft:sentry", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.sentry"}, TemplateItem: "minecraft:sentry_armor_trim_smithing_template"}, "minecraft:shaper": {AssetId: "minecraft:shaper", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.shaper"}, TemplateItem: "minecraft:shaper_armor_trim_smithing_template"}, "minecraft:silence": {AssetId: "minecraft:silence", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.silence"}, TemplateItem: "minecraft:silence_armor_trim_smithing_template"}, "minecraft:snout": {AssetId: "minecraft:snout", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.snout"}, TemplateItem: "minecraft:snout_armor_trim_smithing_template"}, "minecraft:spire": {AssetId: "minecraft:spire", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.spire"}, TemplateItem: "minecraft:spire_armor_trim_smithing_template"}, "minecraft:tide": {AssetId: "minecraft:tide", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.tide"}, TemplateItem: "minecraft:tide_armor_trim_smithing_template"}, "minecraft:vex": {AssetId: "minecraft:vex", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.vex"}, TemplateItem: "minecraft:vex_armor_trim_smithing_template"}, "minecraft:ward": {AssetId: "minecraft:ward", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.ward"}, TemplateItem: "minecraft:ward_armor_trim_smithing_template"}, "minecraft:wayfinder": {AssetId: "minecraft:wayfinder", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.wayfinder"}, TemplateItem: "minecraft:wayfinder_armor_trim_smithing_template"}, "minecraft:wild": {AssetId: "minecraft:wild", Decal: false, Description: struct { - Translate string "nbt:\"translate\"" -}{Translate: "trim_pattern.minecraft.wild"}, TemplateItem: "minecraft:wild_armor_trim_smithing_template"}}, WolfVariant: map[string]struct { - AngryTexture string "nbt:\"angry_texture\"" - Biomes string "nbt:\"biomes\"" - TameTexture string "nbt:\"tame_texture\"" - WildTexture string "nbt:\"wild_texture\"" -}{"minecraft:ashen": {AngryTexture: "minecraft:entity/wolf/wolf_ashen_angry", Biomes: "minecraft:snowy_taiga", TameTexture: "minecraft:entity/wolf/wolf_ashen_tame", WildTexture: "minecraft:entity/wolf/wolf_ashen"}, "minecraft:black": {AngryTexture: "minecraft:entity/wolf/wolf_black_angry", Biomes: "minecraft:old_growth_pine_taiga", TameTexture: "minecraft:entity/wolf/wolf_black_tame", WildTexture: "minecraft:entity/wolf/wolf_black"}, "minecraft:chestnut": {AngryTexture: "minecraft:entity/wolf/wolf_chestnut_angry", Biomes: "minecraft:old_growth_spruce_taiga", TameTexture: "minecraft:entity/wolf/wolf_chestnut_tame", WildTexture: "minecraft:entity/wolf/wolf_chestnut"}, "minecraft:pale": {AngryTexture: "minecraft:entity/wolf/wolf_angry", Biomes: "minecraft:taiga", TameTexture: "minecraft:entity/wolf/wolf_tame", WildTexture: "minecraft:entity/wolf/wolf"}, "minecraft:rusty": {AngryTexture: "minecraft:entity/wolf/wolf_rusty_angry", Biomes: "#minecraft:is_jungle", TameTexture: "minecraft:entity/wolf/wolf_rusty_tame", WildTexture: "minecraft:entity/wolf/wolf_rusty"}, "minecraft:snowy": {AngryTexture: "minecraft:entity/wolf/wolf_snowy_angry", Biomes: "minecraft:grove", TameTexture: "minecraft:entity/wolf/wolf_snowy_tame", WildTexture: "minecraft:entity/wolf/wolf_snowy"}, "minecraft:spotted": {AngryTexture: "minecraft:entity/wolf/wolf_spotted_angry", Biomes: "#minecraft:is_savanna", TameTexture: "minecraft:entity/wolf/wolf_spotted_tame", WildTexture: "minecraft:entity/wolf/wolf_spotted"}, "minecraft:striped": {AngryTexture: "minecraft:entity/wolf/wolf_striped_angry", Biomes: "#minecraft:is_badlands", TameTexture: "minecraft:entity/wolf/wolf_striped_tame", WildTexture: "minecraft:entity/wolf/wolf_striped"}, "minecraft:woods": {AngryTexture: "minecraft:entity/wolf/wolf_woods_angry", Biomes: "minecraft:forest", TameTexture: "minecraft:entity/wolf/wolf_woods_tame", WildTexture: "minecraft:entity/wolf/wolf_woods"}}, WorldgenBiome: map[string]struct { - Downfall float32 "nbt:\"downfall\"" - Effects struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" - } "nbt:\"effects\"" - HasPrecipitation bool "nbt:\"has_precipitation\"" - Temperature float32 "nbt:\"temperature\"" -}{"minecraft:badlands": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:bamboo_jungle": {Downfall: 0.9, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7842047, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.95}, "minecraft:basalt_deltas": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 6840176, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.basalt_deltas.mood", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:beach": {Downfall: 0.4, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7907327, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.8}, "minecraft:birch_forest": {Downfall: 0.6, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8037887, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.6}, "minecraft:cherry_grove": {Downfall: 0.8, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 6141935, WaterFogColor: 6141935}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:cold_ocean": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 4020182, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:crimson_forest": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 3343107, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.crimson_forest.mood", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:dark_forest": {Downfall: 0.8, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7972607, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.7}, "minecraft:deep_cold_ocean": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 4020182, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:deep_dark": {Downfall: 0.4, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7907327, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.8}, "minecraft:deep_frozen_ocean": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 3750089, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:deep_lukewarm_ocean": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 4566514, WaterFogColor: 267827}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:deep_ocean": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:desert": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:dripstone_caves": {Downfall: 0.4, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7907327, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.8}, "minecraft:end_barrens": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 10518688, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 0, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 0.5}, "minecraft:end_highlands": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 10518688, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 0, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 0.5}, "minecraft:end_midlands": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 10518688, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 0, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 0.5}, "minecraft:eroded_badlands": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:flower_forest": {Downfall: 0.8, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7972607, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.7}, "minecraft:forest": {Downfall: 0.8, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7972607, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.7}, "minecraft:frozen_ocean": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8364543, WaterColor: 3750089, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0}, "minecraft:frozen_peaks": {Downfall: 0.9, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8756735, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: -0.7}, "minecraft:frozen_river": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8364543, WaterColor: 3750089, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0}, "minecraft:grove": {Downfall: 0.8, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8495359, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: -0.2}, "minecraft:ice_spikes": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8364543, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0}, "minecraft:jagged_peaks": {Downfall: 0.9, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8756735, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: -0.7}, "minecraft:jungle": {Downfall: 0.9, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7842047, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.95}, "minecraft:lukewarm_ocean": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 4566514, WaterFogColor: 267827}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:lush_caves": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:mangrove_swamp": {Downfall: 0.9, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7907327, WaterColor: 3832426, WaterFogColor: 5077600}, HasPrecipitation: true, Temperature: 0.8}, "minecraft:meadow": {Downfall: 0.8, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 937679, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:mushroom_fields": {Downfall: 1, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7842047, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.9}, "minecraft:nether_wastes": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 3344392, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.nether_wastes.mood", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:ocean": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:old_growth_birch_forest": {Downfall: 0.6, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8037887, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.6}, "minecraft:old_growth_pine_taiga": {Downfall: 0.8, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8168447, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.3}, "minecraft:old_growth_spruce_taiga": {Downfall: 0.8, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8233983, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.25}, "minecraft:plains": {Downfall: 0.4, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7907327, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.8}, "minecraft:river": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:savanna": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:savanna_plateau": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:small_end_islands": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 10518688, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 0, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 0.5}, "minecraft:snowy_beach": {Downfall: 0.3, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8364543, WaterColor: 4020182, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.05}, "minecraft:snowy_plains": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8364543, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0}, "minecraft:snowy_slopes": {Downfall: 0.9, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8560639, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: -0.3}, "minecraft:snowy_taiga": {Downfall: 0.4, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8625919, WaterColor: 4020182, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: -0.5}, "minecraft:soul_sand_valley": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 1787717, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.soul_sand_valley.mood", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:sparse_jungle": {Downfall: 0.8, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7842047, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.95}, "minecraft:stony_peaks": {Downfall: 0.3, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7776511, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 1}, "minecraft:stony_shore": {Downfall: 0.3, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8233727, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.2}, "minecraft:sunflower_plains": {Downfall: 0.4, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7907327, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.8}, "minecraft:swamp": {Downfall: 0.9, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7907327, WaterColor: 6388580, WaterFogColor: 2302743}, HasPrecipitation: true, Temperature: 0.8}, "minecraft:taiga": {Downfall: 0.8, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8233983, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.25}, "minecraft:the_end": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 10518688, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 0, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 0.5}, "minecraft:the_void": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 0.5}, "minecraft:warm_ocean": {Downfall: 0.5, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8103167, WaterColor: 4445678, WaterFogColor: 270131}, HasPrecipitation: true, Temperature: 0.5}, "minecraft:warped_forest": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 1705242, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.warped_forest.mood", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:windswept_forest": {Downfall: 0.3, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8233727, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.2}, "minecraft:windswept_gravelly_hills": {Downfall: 0.3, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8233727, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.2}, "minecraft:windswept_hills": {Downfall: 0.3, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 8233727, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: true, Temperature: 0.2}, "minecraft:windswept_savanna": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}, "minecraft:wooded_badlands": {Downfall: 0, Effects: struct { - FogColor int32 "nbt:\"fog_color\"" - FoliageColor int32 "nbt:\"foliage_color,omitempty\"" - GrassColor int32 "nbt:\"grass_color,omitempty\"" - MoodSound struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" - } "nbt:\"mood_sound\"" - Music struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" - } "nbt:\"music,omitempty\"" - SkyColor int32 "nbt:\"sky_color\"" - WaterColor int32 "nbt:\"water_color\"" - WaterFogColor int32 "nbt:\"water_fog_color\"" -}{FogColor: 12638463, FoliageColor: 0, GrassColor: 0, MoodSound: struct { - BlockSearchExtent int32 "nbt:\"block_search_extent\"" - Offset float64 "nbt:\"offset\"" - Sound string "nbt:\"sound\"" - TickDelay int32 "nbt:\"tick_delay\"" -}{BlockSearchExtent: 8, Offset: 2, Sound: "minecraft:ambient.cave", TickDelay: 6000}, Music: struct { - MaxDelay int32 "nbt:\"max_delay\"" - MinDelay int32 "nbt:\"min_delay\"" - ReplaceCurrentMusic bool "nbt:\"replace_current_music\"" - Sound string "nbt:\"sound\"" -}{MaxDelay: 0, MinDelay: 0, ReplaceCurrentMusic: false, Sound: ""}, SkyColor: 7254527, WaterColor: 4159204, WaterFogColor: 329011}, HasPrecipitation: false, Temperature: 2}}} diff --git a/protocol/net/registry/registry.go b/protocol/net/registry/registry.go index e681a47e..38ce5285 100644 --- a/protocol/net/registry/registry.go +++ b/protocol/net/registry/registry.go @@ -23,7 +23,7 @@ type ChatType struct { } type Dimension1 struct { - FixedTime int64 `nbt:"fixed_time"` + FixedTime int64 `nbt:"fixed_time,omitempty"` AmbientLight float32 `nbt:"ambient_light"` BedWorks bool `nbt:"bed_works"` CoordinateScale float64 `nbt:"coordinate_scale"` @@ -44,7 +44,7 @@ type Dimension1 struct { } type Dimension struct { - FixedTime int64 `nbt:"fixed_time"` + FixedTime int64 `nbt:"fixed_time,omitempty"` AmbientLight float32 `nbt:"ambient_light"` BedWorks bool `nbt:"bed_works"` CoordinateScale float64 `nbt:"coordinate_scale"` diff --git a/protocol/net/slot/comp_dec.go b/protocol/net/slot/comp_dec.go index 0c92d344..8db81c88 100644 --- a/protocol/net/slot/comp_dec.go +++ b/protocol/net/slot/comp_dec.go @@ -1,11 +1,11 @@ package slot import ( - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/text" ) -func decode(r io.Reader, comp *Component) error { +func decode(r encoding.Reader, comp *Component) error { switch comp.Type { case CustomData: comp.Data = make(map[string]any) diff --git a/protocol/net/slot/slot.go b/protocol/net/slot/slot.go index dfa8bb9b..1c197379 100644 --- a/protocol/net/slot/slot.go +++ b/protocol/net/slot/slot.go @@ -1,6 +1,8 @@ package slot -import "github.com/zeppelinmc/zeppelin/protocol/net/io" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" +) type Slot struct { ItemCount int32 @@ -14,7 +16,7 @@ type Component struct { Data any } -func (s *Slot) Encode(w io.Writer) error { +func (s *Slot) Encode(w encoding.Writer) error { if err := w.VarInt(s.ItemCount); err != nil { return err } @@ -38,7 +40,7 @@ func (s *Slot) Encode(w io.Writer) error { return nil } -func (s *Slot) Decode(r io.Reader) error { +func (s *Slot) Decode(r encoding.Reader) error { if _, err := r.VarInt(&s.ItemCount); err != nil { return err } @@ -50,6 +52,7 @@ func (s *Slot) Decode(r io.Reader) error { if _, err := r.VarInt(&componentAddLength); err != nil { return err } + s.Add = make([]Component, componentAddLength) for _, comp := range s.Add { if err := decode(r, &comp); err != nil { diff --git a/protocol/properties/properties.go b/protocol/properties/properties.go index 39c111ea..565e7229 100644 --- a/protocol/properties/properties.go +++ b/protocol/properties/properties.go @@ -71,8 +71,8 @@ type ServerProperties struct { SpawnNPCs bool `properties:"spawn-npcs"` SpawnProtection int `properties:"spawn-protection"` - ViewDistance int `properties:"view-distance"` - WhiteList bool `properties:"white-list"` + ViewDistance int32 `properties:"view-distance"` + WhiteList bool `properties:"white-list"` } var Default = ServerProperties{ diff --git a/server/command/builder.go b/server/command/builder.go index 04670f5b..7b519cdb 100644 --- a/server/command/builder.go +++ b/server/command/builder.go @@ -75,7 +75,7 @@ func NewNode(n play.Node, children ...Node) Node { return Node{n, children} } -func NewCommand(name string, nodes ...Node) Node { +func NewLiteral(name string, nodes ...Node) Node { return Node{ Node: play.Node{ Flags: play.NodeLiteral, @@ -121,7 +121,7 @@ func NewIntegerArgument(name string, min, max *int32, nodes ...Node) Node { } } -func NewStringArgument(name string, typ int32, nodes ...Node) Node { +func NewStringArgument(name string, typ int, nodes ...Node) Node { return Node{ Node: play.Node{ Flags: play.NodeArgument, @@ -132,3 +132,15 @@ func NewStringArgument(name string, typ int32, nodes ...Node) Node { children: nodes, } } + +func NewTimeArgument(name string, min int32, nodes ...Node) Node { + return Node{ + Node: play.Node{ + Flags: play.NodeArgument, + Name: name, + ParserId: Time, + Properties: []any{min}, + }, + children: nodes, + } +} diff --git a/server/command/command.go b/server/command/command.go index 60cf7e22..d3897f23 100644 --- a/server/command/command.go +++ b/server/command/command.go @@ -2,6 +2,7 @@ package command import ( + "github.com/zeppelinmc/zeppelin/protocol/text" "github.com/zeppelinmc/zeppelin/server/session" ) @@ -37,3 +38,7 @@ type CommandCallContext struct { Arguments Arguments } + +func (c CommandCallContext) Reply(msg text.TextComponent) error { + return c.Executor.SystemMessage(msg) +} diff --git a/server/container/container.go b/server/container/container.go index b1eadc12..d46b909b 100644 --- a/server/container/container.go +++ b/server/container/container.go @@ -54,11 +54,11 @@ func (c *Container) SetSlot(item item.Item) { } // finds the item at the specified data slot -func (c Container) Slot(slot item.DataSlot) (item.Item, bool) { +func (c Container) Slot(slot item.DataSlot) (*item.Item, bool) { for _, item := range c { if item.Slot == slot { - return item, true + return &item, true } } - return item.Item{}, false + return nil, false } diff --git a/server/server.go b/server/server.go index 1b9e5789..e542c3ba 100644 --- a/server/server.go +++ b/server/server.go @@ -136,6 +136,17 @@ func (srv *Server) Start(ts time.Time) { srv.loadPlugins() } } + + log.Infoln("Preparing world spawn...") + ow := srv.World.Dimension("minecraft:overworld") + + spawnCX, spawnCZ := srv.World.Data.SpawnX>>4, srv.World.Data.SpawnZ>>4 + for x := spawnCX - srv.cfg.ViewDistance; x < spawnCX+srv.cfg.ViewDistance; x++ { + for z := spawnCZ - srv.cfg.ViewDistance; z < spawnCZ+srv.cfg.ViewDistance; z++ { + ow.GetChunk(x, z) + } + } + srv.timeStart = ts log.Infolnf("Done! (%s)", time.Since(ts)) for { @@ -198,4 +209,7 @@ func (srv *Server) formatTimestart() string { func (srv *Server) createTicker() { srv.TickManager = tick.New(20, srv.World.Broadcast) + srv.TickManager.AddNew(func() { + srv.World.IncrementTime() + }) } diff --git a/server/session/broadcast.go b/server/session/broadcast.go index 95d8c7ce..22b3aa6c 100644 --- a/server/session/broadcast.go +++ b/server/session/broadcast.go @@ -203,7 +203,6 @@ func (b *Broadcast) RemoveUUIDs(disconnectionReason text.TextComponent, uuids .. // when a player leaves the server func (b *Broadcast) RemovePlayer(session Session) { - log.Infolnf("[%s] Player %s disconnected", session.Addr(), session.Username()) b.sessions_mu.Lock() defer b.sessions_mu.Unlock() delete(b.sessions, session.UUID()) diff --git a/server/session/std/chunkLoadWorker.go b/server/session/std/chunkLoadWorker.go index 489d66c8..7accc6ca 100644 --- a/server/session/std/chunkLoadWorker.go +++ b/server/session/std/chunkLoadWorker.go @@ -1,29 +1,40 @@ package std -import "github.com/zeppelinmc/zeppelin/server/world/level/region" +import ( + "github.com/zeppelinmc/zeppelin/protocol/net/packet/play" + "github.com/zeppelinmc/zeppelin/server/world/level/region" +) // ChunkLoadWorker loads and unloads chunks for the session type ChunkLoadWorker struct { s *StandardSession - requests chan [2]int32 + requests chan [3]int32 //x,z,radius } func NewChunkLoadWorker(s *StandardSession) *ChunkLoadWorker { - return &ChunkLoadWorker{s: s, requests: make(chan [2]int32)} + return &ChunkLoadWorker{s: s, requests: make(chan [3]int32)} } -func (c ChunkLoadWorker) SendChunksRadius(chunkX, chunkZ int32) { - c.requests <- [2]int32{chunkX, chunkZ} +func (c ChunkLoadWorker) SendChunksRadius(chunkX, chunkZ, radius int32) { + c.requests <- [3]int32{chunkX, chunkZ, radius} } -func (c ChunkLoadWorker) sendChunksRadius(chunkX, chunkZ int32) error { - viewDistance := c.s.ViewDistance() - +func (c ChunkLoadWorker) sendChunksRadius(chunkX, chunkZ, rad int32) error { c.s.load_ch_mu.Lock() defer c.s.load_ch_mu.Unlock() - for x := chunkX - viewDistance; x < chunkX+viewDistance; x++ { - for z := chunkZ - viewDistance; z < chunkZ+viewDistance; z++ { + if rad == 0 { + rad = c.s.ViewDistance() + } + + var chunks int32 + + if err := c.s.WritePacket(&play.ChunkBatchStart{}); err != nil { + return err + } + + for x := chunkX - rad; x < chunkX+rad; x++ { + for z := chunkZ - rad; z < chunkZ+rad; z++ { if _, ok := c.s.loadedChunks[region.ChunkHash(x, z)]; ok { continue } @@ -36,16 +47,65 @@ func (c ChunkLoadWorker) sendChunksRadius(chunkX, chunkZ int32) error { if err := c.s.WritePacket(chunk.Encode(c.s.registryIndexes["minecraft:worldgen/biome"])); err != nil { return err } + chunks++ } } + if err := c.s.WritePacket(&play.ChunkBatchFinished{ + BatchSize: chunks, + }); err != nil { + return err + } + return nil } func (c ChunkLoadWorker) start() { go func() { - for pos := range c.requests { - c.sendChunksRadius(pos[0], pos[1]) + for req := range c.requests { + c.sendChunksRadius(req[0], req[1], req[2]) } }() } + +func (session *StandardSession) sendSpawnChunks() error { + viewDistance := session.ViewDistance() + + x, _, z := session.player.Position() + chunkX, chunkZ := int32(x)>>4, int32(z)>>4 + + if err := session.WritePacket(&play.SetCenterChunk{ChunkX: chunkX, ChunkZ: chunkZ}); err != nil { + return err + } + + var chunks int32 + + if err := session.WritePacket(&play.ChunkBatchStart{}); err != nil { + return err + } + + for x := chunkX - viewDistance; x < chunkX+viewDistance; x++ { + for z := chunkZ - viewDistance; z < chunkZ+viewDistance; z++ { + c, err := session.Dimension().GetChunk(x, z) + if err != nil { + continue + } + + if err := session.WritePacket(c.Encode(session.registryIndexes["minecraft:worldgen/biome"])); err != nil { + return err + } + chunks++ + } + } + + if err := session.WritePacket(&play.ChunkBatchFinished{ + BatchSize: chunks, + }); err != nil { + return err + } + + session.awaitingChunkBatchAcknowledgement.Store(true) + session.ChunkLoadWorker.start() + + return nil +} diff --git a/server/session/std/handler.go b/server/session/std/handler.go index 7fe76d9c..ab978497 100644 --- a/server/session/std/handler.go +++ b/server/session/std/handler.go @@ -4,7 +4,7 @@ import ( "time" "github.com/zeppelinmc/zeppelin/protocol/net" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/packet" "github.com/zeppelinmc/zeppelin/protocol/net/packet/configuration" "github.com/zeppelinmc/zeppelin/protocol/net/packet/play" @@ -40,14 +40,15 @@ func (session *StandardSession) handlePackets() { select { case <-keepAlive.C: l := time.Now().UnixMilli() - session.cbLastKeepAlive.Set(l) + session.cbLastKeepAlive.Store(l) session.conn.WritePacket(&play.ClientboundKeepAlive{KeepAliveID: l}) default: - if lastKeepAlive := session.sbLastKeepalive.Get(); lastKeepAlive != 0 && time.Now().UnixMilli()-lastKeepAlive > (21*1000) { + if lastKeepAlive := session.sbLastKeepalive.Load(); lastKeepAlive != 0 && time.Now().UnixMilli()-lastKeepAlive > (21*1000) { session.Disconnect(text.TextComponent{Text: "Timed out"}) } p, err := session.conn.ReadPacket() if err != nil { + log.Infolnf("[%s] Player %s disconnected: lost connection", session.Addr(), session.Username()) session.broadcast.RemovePlayer(session) return } @@ -60,23 +61,24 @@ func (session *StandardSession) handlePackets() { if !ok { switch pk := p.(type) { case *play.ChunkBatchReceived: - session.awaitingChunkBatchAcknowledgement.Set(false) + session.chunksPerTick.Store(int32(pk.ChunksPerTick)) + session.awaitingChunkBatchAcknowledgement.Store(false) case *play.ServerboundKeepAlive: - session.sbLastKeepalive.Set(time.Now().UnixMilli()) + session.sbLastKeepalive.Store(time.Now().UnixMilli()) session.broadcast.PlayerInfoUpdateLatency(session) case *play.PlayerSession: - session.hasSessionData.Set(true) + session.hasSessionData.Store(true) session.sessionData.Set(*pk) session.broadcast.PlayerInfoUpdateSession(session) case *configuration.ServerboundPluginMessage: if pk.Channel == "minecraft:brand" { - _, data, _ := io.VarInt(pk.Data) + _, data, _ := encoding.VarInt(pk.Data) session.clientName = string(data) } case *play.ServerboundPluginMessage: if pk.Channel == "minecraft:brand" { - _, data, _ := io.VarInt(pk.Data) + _, data, _ := encoding.VarInt(pk.Data) session.clientName = string(data) } case *configuration.AcknowledgeFinishConfiguration: diff --git a/server/session/std/handler/chatMessage.go b/server/session/std/handler/chatMessage.go index 740e7b73..6e8213d5 100644 --- a/server/session/std/handler/chatMessage.go +++ b/server/session/std/handler/chatMessage.go @@ -24,9 +24,8 @@ func handleChatMessage(s *std.StandardSession, pk packet.Decodeable) { return } if cfg.EnforceSecureProfile { - i := s.ChatIndex.Get() - s.Broadcast().SecureChatMessage(s, *cm, i) - s.ChatIndex.Set(i + 1) + i := s.ChatIndex.Add(1) + s.Broadcast().SecureChatMessage(s, *cm, i-1) return } if cfg.SystemChatFormat == "" { diff --git a/server/session/std/handler/closeContainer.go b/server/session/std/handler/closeContainer.go index 14ea15e7..fb8c0fd2 100644 --- a/server/session/std/handler/closeContainer.go +++ b/server/session/std/handler/closeContainer.go @@ -17,9 +17,9 @@ func handleCloseContainer(s *std.StandardSession, p packet.Decodeable) { if !ok { return } - if s.WindowView.Get() == int32(pk.WindowId) { + if s.WindowView.Load() == int32(pk.WindowId) { pos, w, ok := s.Dimension().WindowManager.Get(int32(pk.WindowId)) - s.WindowView.Set(0) + s.WindowView.Store(0) if !ok { return } diff --git a/server/session/std/handler/confirmTeleportation.go b/server/session/std/handler/confirmTeleportation.go index 12a68c7d..3e418138 100644 --- a/server/session/std/handler/confirmTeleportation.go +++ b/server/session/std/handler/confirmTeleportation.go @@ -12,6 +12,5 @@ func init() { } func handleConfirmTeleportation(session *std.StandardSession, p packet.Decodeable) { - session.AwaitingTeleportAcknowledgement.Set(false) - + session.AwaitingTeleportAcknowledgement.Store(false) } diff --git a/server/session/std/handler/movement.go b/server/session/std/handler/movement.go index cda4e85e..d7aa7cbb 100644 --- a/server/session/std/handler/movement.go +++ b/server/session/std/handler/movement.go @@ -15,7 +15,7 @@ func init() { } func handleMovement(s *std.StandardSession, p packet.Decodeable) { - if s.AwaitingTeleportAcknowledgement.Get() { + if s.AwaitingTeleportAcknowledgement.Load() { return } switch pk := p.(type) { diff --git a/server/session/std/handler/useItemOn.go b/server/session/std/handler/useItemOn.go index b3819d9c..61ed482f 100644 --- a/server/session/std/handler/useItemOn.go +++ b/server/session/std/handler/useItemOn.go @@ -1,6 +1,7 @@ package handler import ( + "fmt" "math" "github.com/zeppelinmc/zeppelin/protocol/net" @@ -48,6 +49,9 @@ func handleUseItemOn(s *std.StandardSession, pk packet.Decodeable) { if !ok { return } + if itemInHand.Is("beds") { + fmt.Println("is placing bed ") + } blockSet, ok := itemInHand.Block() if !ok { return diff --git a/server/session/std/session.go b/server/session/std/session.go index fa1ca846..28e3ea3b 100644 --- a/server/session/std/session.go +++ b/server/session/std/session.go @@ -7,10 +7,11 @@ import ( nnet "net" "slices" "sync" + "sync/atomic" "github.com/google/uuid" "github.com/zeppelinmc/zeppelin/protocol/net" - "github.com/zeppelinmc/zeppelin/protocol/net/io" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/metadata" "github.com/zeppelinmc/zeppelin/protocol/net/packet" "github.com/zeppelinmc/zeppelin/protocol/net/packet/configuration" @@ -34,7 +35,7 @@ import ( "github.com/zeppelinmc/zeppelin/server/world/dimension/window" "github.com/zeppelinmc/zeppelin/server/world/level" "github.com/zeppelinmc/zeppelin/util" - "github.com/zeppelinmc/zeppelin/util/atomic" + a "github.com/zeppelinmc/zeppelin/util/atomic" ) var _ session.Session = (*StandardSession)(nil) @@ -52,12 +53,12 @@ type StandardSession struct { conn *net.Conn clientName string // constant - ClientInfo atomic.AtomicValue[configuration.ClientInformation] + ClientInfo a.AtomicValue[configuration.ClientInformation] statusProviderProvider func() net.StatusProvider - hasSessionData atomic.AtomicValue[bool] - sessionData atomic.AtomicValue[play.PlayerSession] + hasSessionData atomic.Bool + sessionData a.AtomicValue[play.PlayerSession] spawned_ents_mu sync.Mutex spawnedEntities []int32 @@ -67,31 +68,35 @@ type StandardSession struct { registryIndexes map[string][]string // the index that should be sent in player chat messages - ChatIndex atomic.AtomicValue[int32] + ChatIndex atomic.Int32 - inBundle atomic.AtomicValue[bool] + inBundle atomic.Bool - AwaitingTeleportAcknowledgement atomic.AtomicValue[bool] - awaitingChunkBatchAcknowledgement atomic.AtomicValue[bool] + AwaitingTeleportAcknowledgement, + awaitingChunkBatchAcknowledgement atomic.Bool // the time in milliseconds that the keep alive packet was sent to the server from the client - sbLastKeepalive atomic.AtomicValue[int64] + sbLastKeepalive atomic.Int64 // the time in milliseconds that the keep alive packet was sent to the client from the server - cbLastKeepAlive atomic.AtomicValue[int64] + cbLastKeepAlive atomic.Int64 load_ch_mu sync.RWMutex loadedChunks map[uint64]struct{} - listed atomic.AtomicValue[bool] + listed atomic.Bool tick *tick.TickManager + stopTick chan struct{} + // the window id the client is viewing currently, 0 if none (inventory) - WindowView atomic.AtomicValue[int32] + WindowView atomic.Int32 + + chunksPerTick atomic.Int32 } func (s *StandardSession) Latency() int64 { - return s.sbLastKeepalive.Get() - s.cbLastKeepAlive.Get() + return s.sbLastKeepalive.Load() - s.cbLastKeepAlive.Load() } func New( @@ -114,12 +119,12 @@ func New( commandManager: commandManager, loadedChunks: make(map[uint64]struct{}), - tick: tickManager, - - listed: atomic.Value(true), + tick: tickManager, + stopTick: make(chan struct{}), registryIndexes: make(map[string][]string), } + s.listed.Store(true) s.ChunkLoadWorker = NewChunkLoadWorker(s) s.Input.SetPosition(s.player.Position()) @@ -147,17 +152,17 @@ func (session *StandardSession) ReadPacket() (packet.Decodeable, error) { } func (session *StandardSession) Listed() bool { - return session.listed.Get() + return session.listed.Load() } func (session *StandardSession) SetListed(v bool) { - session.listed.Set(v) + session.listed.Store(v) } func (session *StandardSession) SynchronizePosition(x, y, z float64, yaw, pitch float32) error { session.player.SetPosition(x, y, z) session.player.SetRotation(yaw, pitch) - session.AwaitingTeleportAcknowledgement.Set(true) + session.AwaitingTeleportAcknowledgement.Store(true) return session.WritePacket(&play.SynchronizePlayerPosition{X: x, Y: y, Z: z, Yaw: yaw, Pitch: pitch}) } @@ -230,7 +235,7 @@ func (session *StandardSession) Properties() []login.Property { } func (session *StandardSession) SessionData() (play.PlayerSession, bool) { - return session.sessionData.Get(), session.hasSessionData.Get() + return session.sessionData.Get(), session.hasSessionData.Load() } func (session *StandardSession) PlayerInfoUpdate(pk *play.PlayerInfoUpdate) error { @@ -255,7 +260,7 @@ func (session *StandardSession) Configure() error { go session.handlePackets() if err := session.WritePacket(&configuration.ClientboundPluginMessage{ Channel: "minecraft:brand", - Data: io.AppendString(nil, "Zeppelin"), + Data: encoding.AppendString(nil, "Zeppelin"), }); err != nil { return err } @@ -322,7 +327,7 @@ func (session *StandardSession) login() error { return err } - if err := session.WritePacket(session.commandManager.Encode()); err != nil { + if err := session.WritePacket(&play.SetHeldItemClientbound{Slot: int8(session.player.SelectedItemSlot())}); err != nil { return err } @@ -348,11 +353,11 @@ func (session *StandardSession) login() error { return err } - x, y, z := session.player.Position() - yaw, pitch := session.player.Rotation() + if err := session.WritePacket(session.commandManager.Encode()); err != nil { + return err + } status := session.statusProviderProvider()(session.conn) - if err := session.WritePacket(&play.ServerData{ MOTD: status.Description, Icon: status.Favicon, @@ -362,10 +367,7 @@ func (session *StandardSession) login() error { session.broadcast.AddPlayer(session) - if err := session.SendInventory(); err != nil { - return err - } - if err := session.WritePacket(&play.SetHeldItemClientbound{Slot: int8(session.player.SelectedItemSlot())}); err != nil { + if err := session.sendTime(); err != nil { return err } @@ -378,10 +380,17 @@ func (session *StandardSession) login() error { return err } + if err := session.initializeTicker(); err != nil { + return err + } + if err := session.sendSpawnChunks(); err != nil { return err } + x, y, z := session.player.Position() + yaw, pitch := session.player.Rotation() + if err := session.SynchronizePosition(x, y, z, yaw, pitch); err != nil { return err } @@ -390,9 +399,11 @@ func (session *StandardSession) login() error { return err } - session.broadcast.SpawnPlayer(session) - session.createTicker() + if err := session.SendInventory(); err != nil { + return err + } + session.broadcast.SpawnPlayer(session) return nil } @@ -444,18 +455,18 @@ func (session *StandardSession) DespawnEntities(entityIds ...int32) error { } func (session *StandardSession) bundleStart() error { - if session.inBundle.Get() { + if session.inBundle.Load() { return nil } - session.inBundle.Set(true) + session.inBundle.Store(true) return session.WritePacket(&play.BundleDelimiter{}) } func (session *StandardSession) bundleStop() error { - if !session.inBundle.Get() { + if !session.inBundle.Load() { return nil } - session.inBundle.Set(false) + session.inBundle.Store(false) return session.WritePacket(&play.BundleDelimiter{}) } @@ -536,48 +547,6 @@ func (session *StandardSession) SetGameMode(gm level.GameMode) error { }) } -func (session *StandardSession) sendSpawnChunks() error { - viewDistance := session.ViewDistance() - - x, _, z := session.player.Position() - chunkX, chunkZ := int32(x)>>4, int32(z)>>4 - - if err := session.WritePacket(&play.SetCenterChunk{ChunkX: chunkX, ChunkZ: chunkZ}); err != nil { - return err - } - - var chunks int32 - - if err := session.WritePacket(&play.ChunkBatchStart{}); err != nil { - return err - } - - for x := chunkX - viewDistance; x < chunkX+viewDistance; x++ { - for z := chunkZ - viewDistance; z < chunkZ+viewDistance; z++ { - c, err := session.Dimension().GetChunk(x, z) - if err != nil { - continue - } - - if err := session.WritePacket(c.Encode(session.registryIndexes["minecraft:worldgen/biome"])); err != nil { - return err - } - chunks++ - } - } - - if err := session.WritePacket(&play.ChunkBatchFinished{ - BatchSize: chunks, - }); err != nil { - return err - } - - session.awaitingChunkBatchAcknowledgement.Set(true) - session.ChunkLoadWorker.start() - - return nil -} - func (session *StandardSession) DamageEvent(attacker, attacked session.Session, damageType string) error { causeType := slices.Index(session.registryIndexes["minecraft:damage_type"], damageType) if causeType == -1 { @@ -623,10 +592,10 @@ func (session *StandardSession) setContainerContent(container window.Window) err } func (session *StandardSession) OpenWindow(w *window.Window) error { - if curw := session.WindowView.Get(); curw != 0 { + if curw := session.WindowView.Load(); curw != 0 { return fmt.Errorf("window %d already open for client", curw) } - session.WindowView.Set(w.Id) + session.WindowView.Store(w.Id) err := session.WritePacket(&play.OpenScreen{ WindowId: w.Id, diff --git a/server/session/std/tick.go b/server/session/std/tick.go index 4520c06e..db5a8808 100644 --- a/server/session/std/tick.go +++ b/server/session/std/tick.go @@ -3,8 +3,10 @@ package std import ( "math" "sync/atomic" + "time" "github.com/zeppelinmc/zeppelin/protocol/net/packet/play" + "github.com/zeppelinmc/zeppelin/protocol/text" "github.com/zeppelinmc/zeppelin/util/log" ) @@ -45,22 +47,59 @@ func (i *Input) OnGround() bool { return i.onGround.Load() } -func (session *StandardSession) createTicker() { - ticker := session.tick.New() +func (session *StandardSession) initializeTicker() error { + freq := session.tick.Frequency() + ticker := time.NewTicker(freq) + session.tick.Add(ticker) + if err := session.conn.WritePacket(&play.SetTickingState{TickRate: 1 / (float32(freq) / float32(time.Second)), IsFrozen: false}); err != nil { + return err + } + if err := session.conn.WritePacket(&play.StepTick{}); err != nil { + return err + } go func() { - for range ticker.C { - session.processInput() + var tick uint + + for { + select { + case <-session.stopTick: + ticker.Stop() + session.tick.Remove(ticker) + return + case <-ticker.C: + if err := session.processInput(); err != nil { + log.Errorlnf("[%s] Player %s disconnected (tick error: failed to process input: %v) (on tick %d)", session.Addr(), session.Username(), err, tick) + session.Disconnect(text.Sprint("Tick error")) + return + } + if tick%20 == 0 { + if err := session.sendTime(); err != nil { + log.Errorlnf("[%s] Player %s disconnected (tick error: failed to update time: %v) (on tick %d)", session.Addr(), session.Username(), err, tick) + session.Disconnect(text.Sprint("Tick error")) + return + } + } + + tick++ + } } }() + + return nil } -func (session *StandardSession) processInput() { +func (session *StandardSession) sendTime() error { + w, d := session.World.Time() + return session.conn.WritePacket(&play.UpdateTime{WorldAge: w, TimeOfDay: d}) +} + +func (session *StandardSession) processInput() error { x, y, z, yaw, pitch, onGround := session.input() oldX, oldY, oldZ, oldYaw, oldPitch, oldOnGround := session.state() posC, rotC, onC := session.inputUpdated(x, y, z, yaw, pitch, onGround, oldX, oldY, oldZ, oldYaw, oldPitch, oldOnGround) if !posC && !rotC && !onC { - return + return nil } if posC { @@ -68,16 +107,20 @@ func (session *StandardSession) processInput() { newChunkPosX, newChunkPosZ := chunkPos(x, z) if oldChunkPosX != newChunkPosX || oldChunkPosZ != newChunkPosZ { - session.WritePacket(&play.SetCenterChunk{ChunkX: newChunkPosX, ChunkZ: newChunkPosZ}) - session.ChunkLoadWorker.SendChunksRadius(newChunkPosX, newChunkPosZ) + if err := session.WritePacket(&play.SetCenterChunk{ChunkX: newChunkPosX, ChunkZ: newChunkPosZ}); err != nil { + return err + } + session.ChunkLoadWorker.SendChunksRadius(newChunkPosX, newChunkPosZ, 0) } distance := math.Sqrt((x-oldX)*(x-oldX) + (y-oldY)*(y-oldY) + (z-oldZ)*(z-oldZ)) if distance > 100 { - session.SynchronizePosition(oldX, oldY, oldZ, oldYaw, oldPitch) - log.Infof("%s moved too quickly! (%f %f %f)\n", session.Username(), x-oldX, y-oldY, z-oldZ) - return + if err := session.SynchronizePosition(oldX, oldY, oldZ, oldYaw, oldPitch); err != nil { + return err + } + log.Infolnf("%s moved too quickly! (%f %f %f)", session.Username(), x-oldX, y-oldY, z-oldZ) + return nil } defer session.player.SetPosition(x, y, z) } @@ -89,6 +132,8 @@ func (session *StandardSession) processInput() { } session.broadcast.BroadcastPlayerMovement(session, x, y, z, yaw, pitch) + + return nil } func (session *StandardSession) inputUpdated( diff --git a/server/tick/tick.go b/server/tick/tick.go index 31db2a07..1965d0c6 100644 --- a/server/tick/tick.go +++ b/server/tick/tick.go @@ -3,30 +3,41 @@ package tick import ( "fmt" "sync" + "sync/atomic" "time" "github.com/google/uuid" "github.com/zeppelinmc/zeppelin/server/session" - "github.com/zeppelinmc/zeppelin/util/atomic" ) // New creates a new tick manager with tps ticks per second func New(tps int, b *session.Broadcast) *TickManager { - return &TickManager{ - d: atomic.Value(time.Second / time.Duration(tps)), + mgr := &TickManager{ b: b, } + mgr.d.Store(int64(time.Second / time.Duration(tps))) + + return mgr } type TickManager struct { tickers []*time.Ticker mu sync.RWMutex - d atomic.AtomicValue[time.Duration] + d atomic.Int64 b *session.Broadcast } +func (mgr *TickManager) AddNew(f func()) { + tick := mgr.New() + go func() { + for range tick.C { + f() + } + }() +} + func (mgr *TickManager) SetFrequency(tps int) error { mgr.mu.RLock() defer mgr.mu.RUnlock() @@ -36,7 +47,7 @@ func (mgr *TickManager) SetFrequency(tps int) error { } d := time.Second / time.Duration(tps) - mgr.d.Set(d) + mgr.d.Store(int64(d)) for _, ticker := range mgr.tickers { ticker.Reset(d) @@ -61,7 +72,7 @@ func (mgr *TickManager) Freeze() { } func (mgr *TickManager) Unfreeze() { - freq := mgr.d.Get() + freq := time.Duration(mgr.d.Load()) for _, ticker := range mgr.tickers { ticker.Reset(freq) } @@ -93,6 +104,15 @@ func (mgr *TickManager) Count() int { return len(mgr.tickers) } +func (mgr *TickManager) Remove(ticker *time.Ticker) (ok bool) { + for _, t := range mgr.tickers { + if t == ticker { + return true + } + } + return +} + func (mgr *TickManager) Frequency() time.Duration { - return mgr.d.Get() + return time.Duration(mgr.d.Load()) } diff --git a/server/world/block/blockstates/dec.go b/server/world/block/blockstates/dec.go index bafb127e..8320dfb3 100644 --- a/server/world/block/blockstates/dec.go +++ b/server/world/block/blockstates/dec.go @@ -6,8 +6,6 @@ import ( "fmt" "io" "unsafe" - - "github.com/zeppelinmc/zeppelin/protocol/net/io/util" ) type BlockLocation struct { @@ -25,10 +23,10 @@ type Block []BlockState func ReadBlock(f io.ReaderAt, loc BlockLocation) (Block, error) { var blockStates Block - maxxer := util.NewReaderAtMaxxer(f, int(loc.Size), int64(loc.Offset)) + limiter := io.NewSectionReader(f, int64(loc.Offset), int64(loc.Size)) var stateCount uint16 - if err := binary.Read(maxxer, binary.BigEndian, &stateCount); err != nil { + if err := binary.Read(limiter, binary.BigEndian, &stateCount); err != nil { return blockStates, err } @@ -41,10 +39,10 @@ func ReadBlock(f io.ReaderAt, loc BlockLocation) (Block, error) { blockStateId int32 propertyCount uint8 ) - if err := binary.Read(maxxer, binary.BigEndian, &blockStateId); err != nil { + if err := binary.Read(limiter, binary.BigEndian, &blockStateId); err != nil { return blockStates, err } - if err := binary.Read(maxxer, binary.BigEndian, &propertyCount); err != nil { + if err := binary.Read(limiter, binary.BigEndian, &propertyCount); err != nil { return blockStates, err } @@ -52,11 +50,11 @@ func ReadBlock(f io.ReaderAt, loc BlockLocation) (Block, error) { blockStates[i].Properties = make(map[string]string, propertyCount) for j := 0; j < int(propertyCount); j++ { - propertyName, err := readString(maxxer, stringlen) + propertyName, err := readString(limiter, stringlen) if err != nil { return blockStates, nil } - propertyValue, err := readString(maxxer, stringlen) + propertyValue, err := readString(limiter, stringlen) if err != nil { return blockStates, nil } diff --git a/server/world/chunk/encode.go b/server/world/chunk/encode.go index 1ec0eb26..99cd89a8 100644 --- a/server/world/chunk/encode.go +++ b/server/world/chunk/encode.go @@ -5,8 +5,8 @@ import ( "slices" "unsafe" - "github.com/zeppelinmc/zeppelin/protocol/net/io" "github.com/zeppelinmc/zeppelin/protocol/net/io/buffers" + "github.com/zeppelinmc/zeppelin/protocol/net/io/encoding" "github.com/zeppelinmc/zeppelin/protocol/net/packet/play" "github.com/zeppelinmc/zeppelin/server/registry" "github.com/zeppelinmc/zeppelin/server/world/chunk/section" @@ -27,7 +27,7 @@ func (chunk *Chunk) Encode(biomeIndexes []string) *play.ChunkDataUpdateLight { buf.Reset() defer buffers.Buffers.Put(buf) - w := io.NewWriter(buf) + w := encoding.NewWriter(buf) pk := &play.ChunkDataUpdateLight{ CX: chunk.X, @@ -39,12 +39,12 @@ func (chunk *Chunk) Encode(biomeIndexes []string) *play.ChunkDataUpdateLight { BlockEntities: make([]play.BlockEntity, len(chunk.BlockEntities)), - SkyLightMask: make(io.BitSet, 1), - EmptySkyLightMask: make(io.BitSet, 1), + SkyLightMask: make(encoding.BitSet, 1), + EmptySkyLightMask: make(encoding.BitSet, 1), SkyLightArrays: make([][]byte, 1, len(chunk.Sections)+1), - BlockLightMask: make(io.BitSet, 1), - EmptyBlockLightMask: make(io.BitSet, 1), + BlockLightMask: make(encoding.BitSet, 1), + EmptyBlockLightMask: make(encoding.BitSet, 1), BlockLightArrays: make([][]byte, 1, len(chunk.Sections)+1), } diff --git a/server/world/level/item/item.go b/server/world/level/item/item.go index 984f0bd0..c9ce2067 100644 --- a/server/world/level/item/item.go +++ b/server/world/level/item/item.go @@ -2,8 +2,10 @@ package item import ( "fmt" + "slices" "github.com/zeppelinmc/zeppelin/protocol/net/slot" + "github.com/zeppelinmc/zeppelin/protocol/net/tags" "github.com/zeppelinmc/zeppelin/server/registry" "github.com/zeppelinmc/zeppelin/server/world/chunk/section" ) @@ -121,6 +123,11 @@ type Item struct { } `nbt:"components"`*/ } +// Is checks if the tag applies to the item +func (item *Item) Is(tagName string) bool { + return slices.Index(tags.Tags.Tags["minecraft:item"][tagName], registry.Item.Get(item.Id)) != -1 +} + // returns the block of the item, if found func (i Item) Block() (block section.Block, ok bool) { b := section.GetBlock(i.Id) diff --git a/server/world/level/region/anvil.go b/server/world/level/region/anvil.go index f78abedb..a91a5227 100644 --- a/server/world/level/region/anvil.go +++ b/server/world/level/region/anvil.go @@ -1,6 +1,4 @@ // Package region provides decoding and encoding of Region (.mca) files -// It can decode and encode chunks with all 3 compression schemes (Gzip, Zlib, LZ4) or without any compression -// It uses the net/buffers package to allocate less. package region diff --git a/server/world/level/region/region_dec.go b/server/world/level/region/region_dec.go index f5172685..0739c5ed 100644 --- a/server/world/level/region/region_dec.go +++ b/server/world/level/region/region_dec.go @@ -2,15 +2,16 @@ package region import ( "bytes" + "compress/gzip" "fmt" "io" "sync" "unsafe" - "github.com/zeppelinmc/zeppelin/protocol/nbt/qnbt" + "github.com/4kills/go-zlib" + "github.com/aimjel/minecraft/nbt" "github.com/zeppelinmc/zeppelin/protocol/net/io/buffers" "github.com/zeppelinmc/zeppelin/protocol/net/io/compress" - "github.com/zeppelinmc/zeppelin/protocol/net/io/util" "github.com/zeppelinmc/zeppelin/server/world/chunk" "github.com/zeppelinmc/zeppelin/server/world/chunk/section" ) @@ -52,12 +53,6 @@ func (r *File) LoadedChunks() int32 { return int32(len(r.chunks)) } -var anvilChunks = sync.Pool{ - New: func() any { - return &anvilChunk{} - }, -} - // 1MiB var MaxDecompressedChunkSize = 1024 * 1024 @@ -69,15 +64,6 @@ func (r *File) GetChunk(x, z int32) (*chunk.Chunk, error) { if c, ok := r.chunks[hash]; ok { return c, nil } - - /*if r.generator != nil { - r.chunks[hash] = new(chunk.Chunk) - r.generateChunkAt(x, z, r.chunks[hash], r.generator) - return r.chunks[hash], nil - } else { - return nil, fmt.Errorf("chunk %d %d not found", x, z) - }*/ - locationIndex := 4 * ((x & 31) + (z&31)*32) if int(locationIndex) >= len(r.locations) { if r.generator != nil { @@ -101,51 +87,46 @@ func (r *File) GetChunk(x, z int32) (*chunk.Chunk, error) { return nil, fmt.Errorf("chunk %d %d not found", x, z) } - var chunkHeader = make([]byte, 5) + var chunkHeader [5]byte - _, err := r.reader.ReadAt(chunkHeader, int64(offset)) + _, err := r.reader.ReadAt(chunkHeader[:], int64(offset)) if err != nil { return nil, err } - length := int32(chunkHeader[0])<<24 | int32(chunkHeader[1])<<16 | int32(chunkHeader[2])<<8 | int32(chunkHeader[3]) + length := (int32(chunkHeader[0])<<24 | int32(chunkHeader[1])<<16 | int32(chunkHeader[2])<<8 | int32(chunkHeader[3])) - 1 compression := chunkHeader[4] - length-- if length == 0 { return nil, fmt.Errorf("chunk %d %d not found", x, z) } - var rawReader = util.NewReaderAtMaxxer(r.reader, int(length), int64(offset)+5) + var reader = io.NewSectionReader(r.reader, int64(offset)+5, int64(length)) var chunkBuffer = buffers.Buffers.Get().(*bytes.Buffer) chunkBuffer.Reset() - chunkBuffer.ReadFrom(rawReader) defer buffers.Buffers.Put(chunkBuffer) - var data []byte - switch compression { - case CompressionGzip: - data, _ = compress.DecompressGzip(chunkBuffer.Bytes(), &MaxDecompressedChunkSize) case CompressionZlib: - data, _ = compress.DecompressZlib(chunkBuffer.Bytes(), &MaxDecompressedChunkSize) + z := compress.RZlib.Get().(*zlib.Reader) + z.Reset(reader, nil) + + chunkBuffer.ReadFrom(z) + compress.RZlib.Put(z) + case CompressionGzip: + g := compress.RGzip.Get().(*gzip.Reader) + g.Reset(reader) + + chunkBuffer.ReadFrom(g) + compress.RGzip.Put(z) case CompressionNone: - data = chunkBuffer.Bytes() - case CompressionLZ4: - data, err = compress.DecompressLZ4(chunkBuffer.Bytes()) - if err != nil { - return nil, err - } - default: - return nil, fmt.Errorf("invalid compression method %d", compression) + chunkBuffer.ReadFrom(reader) } - //var anvil = anvilChunks.Get().(*anvilChunk) - //defer anvilChunks.Put(anvil) var anvil = new(anvilChunk) - if _, err := qnbt.Unmarshal(data, anvil); err != nil { + if err := nbt.Unmarshal(chunkBuffer.Bytes(), anvil); err != nil { return nil, err } @@ -182,14 +163,6 @@ func (r *File) GetChunk(x, z int32) (*chunk.Chunk, error) { } return r.chunks[hash], err - - /*chunk, ok := r.chunks[loc] - if !ok { - return chunk, fmt.Errorf("not found chunk") - } - return chunk, nil - }*/ - } func Empty(f *File, rx, rz int32, generateEmpty bool, generator Generator) { diff --git a/server/world/level/region/region_enc.go b/server/world/level/region/region_enc.go index 91ae9f85..a80a7f83 100644 --- a/server/world/level/region/region_enc.go +++ b/server/world/level/region/region_enc.go @@ -67,7 +67,7 @@ func (f *File) Encode(w *os.File, compressionScheme byte) error { switch compressionScheme { case CompressionGzip: - data, err = compress.CompressGzip(chunkBuffer.Bytes(), nil) + //data, err = compress.CompressGzip(chunkBuffer.Bytes(), nil) if err != nil { return err } diff --git a/server/world/world.go b/server/world/world.go index 864a6a15..47bea731 100644 --- a/server/world/world.go +++ b/server/world/world.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "strings" + "sync/atomic" "github.com/zeppelinmc/zeppelin/protocol/properties" "github.com/zeppelinmc/zeppelin/server/session" @@ -11,7 +12,6 @@ import ( "github.com/zeppelinmc/zeppelin/server/world/level" "github.com/zeppelinmc/zeppelin/server/world/level/region" "github.com/zeppelinmc/zeppelin/server/world/terrain" - "github.com/zeppelinmc/zeppelin/util/atomic" "github.com/zeppelinmc/zeppelin/util/log" ) @@ -27,7 +27,7 @@ type World struct { lock *os.File path string - worldAge, dayTime atomic.AtomicValue[int64] + worldAge, dayTime atomic.Int64 } const version = 19133 @@ -58,8 +58,8 @@ func NewWorld(props properties.ServerProperties) (*World, error) { return nil, fmt.Errorf("failed to obtain session.lock") } - w.worldAge = atomic.Value(w.Level.Data.Time) - w.dayTime = atomic.Value(w.Level.Data.DayTime) + w.worldAge.Store(w.Level.Data.Time) + w.dayTime.Store(w.Level.Data.DayTime) w.dimensions = map[string]*dimension.Dimension{ "minecraft:overworld": dimension.New( props.LevelName+"/region", @@ -125,15 +125,28 @@ func (w *World) RegisterDimension(name string, dim *dimension.Dimension) { // increments the day time and world age by one tick and returns the updated time func (w *World) IncrementTime() (worldAge, dayTime int64) { - worldAge = w.worldAge.Get() + 1 - dayTime = w.dayTime.Get() + 1 - - w.worldAge.Set(worldAge) - w.dayTime.Set(dayTime) + worldAge = w.worldAge.Add(1) + dayTime = w.dayTime.Add(1) return } +func (w *World) Time() (worldAge, dayTime int64) { + return w.worldAge.Load(), w.dayTime.Load() +} + +func (w *World) DaytimeAdd(delta int64) { + w.dayTime.Add(delta) +} + +func (w *World) DaytimeSet(v int64) { + w.dayTime.Store(v) +} + +func (w *World) WorldAgeSet(v int64) { + w.worldAge.Store(v) +} + func (w *World) LoadedChunks() int32 { var count int32