Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Implement support for 1.20.30 #813

Merged
merged 3 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
module github.com/df-mc/dragonfly

go 1.18
go 1.19

require (
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9
github.com/cespare/xxhash v1.1.0
github.com/df-mc/atomic v1.10.0
github.com/df-mc/goleveldb v1.1.9
github.com/df-mc/worldupgrader v1.0.8
github.com/df-mc/worldupgrader v1.0.9
github.com/go-gl/mathgl v1.0.0
github.com/google/uuid v1.3.0
github.com/pelletier/go-toml v1.9.5
github.com/rogpeppe/go-internal v1.9.0
github.com/sandertv/gophertunnel v1.31.1-0.20230822231139-d4949d32a3ad
github.com/sandertv/gophertunnel v1.32.2
github.com/sirupsen/logrus v1.9.0
go.uber.org/atomic v1.10.0
golang.org/x/exp v0.0.0-20230206171751-46f607a40771
Expand Down
21 changes: 4 additions & 17 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cloud.google.com/go/compute/metadata v0.2.0 h1:nBbNSZyDpkNlo3DepaaLKVuO7ClyifSAmNloSCZrHnQ=
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9 h1:/G0ghZwrhou0Wq21qc1vXXMm/t/aKWkALWwITptKbE0=
Expand All @@ -12,9 +11,8 @@ github.com/df-mc/atomic v1.10.0 h1:0ZuxBKwR/hxcFGorKiHIp+hY7hgY+XBTzhCYD2NqSEg=
github.com/df-mc/atomic v1.10.0/go.mod h1:Gw9rf+rPIbydMjA329Jn4yjd/O2c/qusw3iNp4tFGSc=
github.com/df-mc/goleveldb v1.1.9 h1:ihdosZyy5jkQKrxucTQmN90jq/2lUwQnJZjIYIC/9YU=
github.com/df-mc/goleveldb v1.1.9/go.mod h1:+NHCup03Sci5q84APIA21z3iPZCuk6m6ABtg4nANCSk=
github.com/df-mc/worldupgrader v1.0.8 h1:T9p7d6o9Yx65qsnK20VYXUNOl9ZY9/5D/fbJBXKsi3o=
github.com/df-mc/worldupgrader v1.0.8/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/df-mc/worldupgrader v1.0.9 h1:hJxbovEEzhTg/TPZqpwg8BsVTVeoVgDp6q7dMoBlwmA=
github.com/df-mc/worldupgrader v1.0.9/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-gl/mathgl v1.0.0 h1:t9DznWJlXxxjeeKLIdovCOVJQk/GzDEL7h/h+Ro2B68=
github.com/go-gl/mathgl v1.0.0/go.mod h1:yhpkQzEiH9yPyxDUGzkmgScbaBVlhC06qodikEM0ZwQ=
Expand Down Expand Up @@ -44,26 +42,21 @@ github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/sandertv/go-raknet v1.12.0 h1:olUzZlIJyX/pgj/mrsLCZYjKLNDsYiWdvQ4NIm3z0DA=
github.com/sandertv/go-raknet v1.12.0/go.mod h1:Gx+WgZBMQ0V2UoouGoJ8Wj6CDrMBQ4SB2F/ggpl5/+Y=
github.com/sandertv/gophertunnel v1.31.0 h1:og9PmD8tXc0CgRJD2N/Yc3KQgYGU1XvAlOeMhfJXUDs=
github.com/sandertv/gophertunnel v1.31.0/go.mod h1:ekREo7U9TPHh86kbuPMaWA93NMyWsfVvP/iNT3XhAb8=
github.com/sandertv/gophertunnel v1.31.1-0.20230822231139-d4949d32a3ad h1:6RuPYCE0y+6nUe9h4AYJ1tVAcUwg9VFKdssqszxcCsA=
github.com/sandertv/gophertunnel v1.31.1-0.20230822231139-d4949d32a3ad/go.mod h1:ekREo7U9TPHh86kbuPMaWA93NMyWsfVvP/iNT3XhAb8=
github.com/sandertv/gophertunnel v1.32.2 h1:vlm6TonrgdESjcgY8Ixt4mHT4/bdih+NrnsqlBhaUok=
github.com/sandertv/gophertunnel v1.32.2/go.mod h1:+Dbhj3bs74gZoSkyab7kglx1Rbq8S5G7sJd/wr5Qm9g=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
Expand All @@ -77,7 +70,6 @@ golang.org/x/image v0.0.0-20190321063152-3fc05d484e9f/go.mod h1:kZ7UVZpmo3dzQBMx
golang.org/x/image v0.5.0 h1:5JMiNunQeQw++mMOz48/ISeNu3Iweh/JaZU8ZLqHRrI=
golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand All @@ -89,7 +81,6 @@ golang.org/x/oauth2 v0.4.0 h1:NF0gk8LVPg1Ml7SSbGyySuoxdsXitj7TvgvuRxIMc/M=
golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -102,7 +93,6 @@ golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand All @@ -112,17 +102,14 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
Expand Down
4 changes: 2 additions & 2 deletions server/block/anvil.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ func (a Anvil) EncodeItem() (name string, meta int16) {
// EncodeBlock ...
func (a Anvil) EncodeBlock() (string, map[string]any) {
return "minecraft:anvil", map[string]any{
"damage": a.Type.String(),
"direction": int32(horizontalDirection(a.Facing)),
"damage": a.Type.String(),
"minecraft:cardinal_direction": a.Facing.String(),
}
}

Expand Down
6 changes: 3 additions & 3 deletions server/block/blast_furnace.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ func (b BlastFurnace) EncodeItem() (name string, meta int16) {
// EncodeBlock ...
func (b BlastFurnace) EncodeBlock() (name string, properties map[string]interface{}) {
if b.Lit {
return "minecraft:lit_blast_furnace", map[string]interface{}{"facing_direction": int32(b.Facing)}
return "minecraft:lit_blast_furnace", map[string]interface{}{"minecraft:cardinal_direction": b.Facing.String()}
}
return "minecraft:blast_furnace", map[string]interface{}{"facing_direction": int32(b.Facing)}
return "minecraft:blast_furnace", map[string]interface{}{"minecraft:cardinal_direction": b.Facing.String()}
}

// UseOnBlock ...
Expand Down Expand Up @@ -122,7 +122,7 @@ func (b BlastFurnace) DecodeNBT(data map[string]interface{}) interface{} {

// allBlastFurnaces ...
func allBlastFurnaces() (furnaces []world.Block) {
for _, face := range cube.Faces() {
for _, face := range cube.HorizontalFaces() {
furnaces = append(furnaces, BlastFurnace{Facing: face})
furnaces = append(furnaces, BlastFurnace{Facing: face, Lit: true})
}
Expand Down
4 changes: 2 additions & 2 deletions server/block/concrete_powder.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ func (c ConcretePowder) BreakInfo() BreakInfo {

// EncodeItem ...
func (c ConcretePowder) EncodeItem() (name string, meta int16) {
return "minecraft:concrete_powder", int16(c.Colour.Uint8())
return "minecraft:" + c.Colour.String() + "_concrete_powder", 0
}

// EncodeBlock ...
func (c ConcretePowder) EncodeBlock() (name string, properties map[string]any) {
return "minecraft:concrete_powder", map[string]any{"color": c.Colour.SilverString()}
return "minecraft:" + c.Colour.String() + "_concrete_powder", nil
}

// allConcretePowder returns concrete powder with all possible colours.
Expand Down
21 changes: 11 additions & 10 deletions server/block/decorated_pot.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,19 @@ func (p DecoratedPot) EncodeNBT() map[string]any {

// DecodeNBT ...
func (p DecoratedPot) DecodeNBT(data map[string]any) any {
sherds := data["sherds"].([]any)
p.Decorations = [4]PotDecoration{}
for i, name := range sherds {
it, ok := world.ItemByName(name.(string), 0)
if !ok {
panic(fmt.Errorf("unknown item %s", name))
if sherds, ok := data["sherds"]; ok {
for i, name := range sherds.([]any) {
it, ok := world.ItemByName(name.(string), 0)
if !ok {
panic(fmt.Errorf("unknown item %s", name))
}
decoration, ok := it.(PotDecoration)
if !ok {
panic(fmt.Errorf("item %s is not a pot decoration", name))
}
p.Decorations[i] = decoration
}
decoration, ok := it.(PotDecoration)
if !ok {
panic(fmt.Errorf("item %s is not a pot decoration", name))
}
p.Decorations[i] = decoration
}
return p
}
Expand Down
6 changes: 3 additions & 3 deletions server/block/furnace.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ func (f Furnace) EncodeItem() (name string, meta int16) {
// EncodeBlock ...
func (f Furnace) EncodeBlock() (name string, properties map[string]interface{}) {
if f.Lit {
return "minecraft:lit_furnace", map[string]interface{}{"facing_direction": int32(f.Facing)}
return "minecraft:lit_furnace", map[string]interface{}{"minecraft:cardinal_direction": f.Facing.String()}
}
return "minecraft:furnace", map[string]interface{}{"facing_direction": int32(f.Facing)}
return "minecraft:furnace", map[string]interface{}{"minecraft:cardinal_direction": f.Facing.String()}
}

// UseOnBlock ...
Expand Down Expand Up @@ -121,7 +121,7 @@ func (f Furnace) DecodeNBT(data map[string]interface{}) interface{} {

// allFurnaces ...
func allFurnaces() (furnaces []world.Block) {
for _, face := range cube.Faces() {
for _, face := range cube.HorizontalFaces() {
furnaces = append(furnaces, Furnace{Facing: face})
furnaces = append(furnaces, Furnace{Facing: face, Lit: true})
}
Expand Down
12 changes: 6 additions & 6 deletions server/block/lectern.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Lectern struct {
sourceWaterDisplacer

// Facing represents the direction the Lectern is facing.
Facing cube.Direction
Facing cube.Face
// Book is the book currently held by the Lectern.
Book item.Stack
// Page is the page the Lectern is currently on in the book.
Expand Down Expand Up @@ -57,7 +57,7 @@ func (l Lectern) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world
if !used {
return false
}
l.Facing = user.Rotation().Direction().Opposite()
l.Facing = user.Rotation().Direction().Face().Opposite()
place(w, pos, l, user, ctx)
return placed(ctx)
}
Expand Down Expand Up @@ -152,15 +152,15 @@ func (Lectern) EncodeItem() (name string, meta int16) {
// EncodeBlock ...
func (l Lectern) EncodeBlock() (string, map[string]any) {
return "minecraft:lectern", map[string]any{
"direction": int32(horizontalDirection(l.Facing)),
"powered_bit": uint8(0), // We don't support redstone, anyway.
"minecraft:cardinal_direction": l.Facing.String(),
"powered_bit": uint8(0), // We don't support redstone, anyway.
}
}

// allLecterns ...
func allLecterns() (lecterns []world.Block) {
for _, d := range cube.Directions() {
lecterns = append(lecterns, Lectern{Facing: d})
for _, f := range cube.HorizontalFaces() {
lecterns = append(lecterns, Lectern{Facing: f})
}
return
}
9 changes: 8 additions & 1 deletion server/block/slab.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (s Slab) EncodeItem() (string, int16) {
// EncodeBlock ...
func (s Slab) EncodeBlock() (string, map[string]any) {
id, slabType, _ := encodeSlabBlock(s.Block)
properties := map[string]any{"top_slot_bit": s.Top}
properties := map[string]any{"minecraft:vertical_half": s.verticalHalf()}
if slabType != "" {
properties[slabType] = id
id = encodeLegacySlabId(slabType)
Expand All @@ -176,6 +176,13 @@ func (s Slab) EncodeBlock() (string, map[string]any) {
return "minecraft:" + id, properties
}

func (s Slab) verticalHalf() string {
if s.Top {
return "top"
}
return "bottom"
}

// allSlabs ...
func allSlabs() (b []world.Block) {
for _, s := range SlabBlocks() {
Expand Down
6 changes: 3 additions & 3 deletions server/block/smoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ func (s Smoker) EncodeItem() (name string, meta int16) {
// EncodeBlock ...
func (s Smoker) EncodeBlock() (name string, properties map[string]interface{}) {
if s.Lit {
return "minecraft:lit_smoker", map[string]interface{}{"facing_direction": int32(s.Facing)}
return "minecraft:lit_smoker", map[string]interface{}{"minecraft:cardinal_direction": s.Facing.String()}
}
return "minecraft:smoker", map[string]interface{}{"facing_direction": int32(s.Facing)}
return "minecraft:smoker", map[string]interface{}{"minecraft:cardinal_direction": s.Facing.String()}
}

// UseOnBlock ...
Expand Down Expand Up @@ -122,7 +122,7 @@ func (s Smoker) DecodeNBT(data map[string]interface{}) interface{} {

// allSmokers ...
func allSmokers() (smokers []world.Block) {
for _, face := range cube.Faces() {
for _, face := range cube.HorizontalFaces() {
smokers = append(smokers, Smoker{Facing: face})
smokers = append(smokers, Smoker{Facing: face, Lit: true})
}
Expand Down
4 changes: 2 additions & 2 deletions server/block/stained_glass.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ func (g StainedGlass) BreakInfo() BreakInfo {

// EncodeItem ...
func (g StainedGlass) EncodeItem() (name string, meta int16) {
return "minecraft:stained_glass", int16(g.Colour.Uint8())
return "minecraft:" + g.Colour.String() + "_stained_glass", 0
}

// EncodeBlock ...
func (g StainedGlass) EncodeBlock() (name string, properties map[string]any) {
return "minecraft:stained_glass", map[string]any{"color": g.Colour.SilverString()}
return "minecraft:" + g.Colour.String() + "_stained_glass", nil
}

// allStainedGlass returns stained-glass blocks with all possible colours.
Expand Down
4 changes: 2 additions & 2 deletions server/block/stained_glass_pane.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ func (p StainedGlassPane) BreakInfo() BreakInfo {

// EncodeItem ...
func (p StainedGlassPane) EncodeItem() (name string, meta int16) {
return "minecraft:stained_glass_pane", int16(p.Colour.Uint8())
return "minecraft:" + p.Colour.String() + "_stained_glass_pane", 0
}

// EncodeBlock ...
func (p StainedGlassPane) EncodeBlock() (name string, properties map[string]any) {
return "minecraft:stained_glass_pane", map[string]any{"color": p.Colour.SilverString()}
return "minecraft:" + p.Colour.String() + "_stained_glass_pane", nil
}

// allStainedGlassPane returns stained-glass panes with all possible colours.
Expand Down
4 changes: 2 additions & 2 deletions server/block/stained_terracotta.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ func (t StainedTerracotta) SmeltInfo() item.SmeltInfo {

// EncodeItem ...
func (t StainedTerracotta) EncodeItem() (name string, meta int16) {
return "minecraft:stained_hardened_clay", int16(t.Colour.Uint8())
return "minecraft:" + t.Colour.String() + "_terracotta", 0
}

// EncodeBlock ...
func (t StainedTerracotta) EncodeBlock() (name string, properties map[string]any) {
return "minecraft:stained_hardened_clay", map[string]any{"color": t.Colour.SilverString()}
return "minecraft:" + t.Colour.String() + "_terracotta", nil
}

// allStainedTerracotta returns stained terracotta blocks with all possible colours.
Expand Down
2 changes: 1 addition & 1 deletion server/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func loadResources(dir string) ([]*resource.Pack, error) {
}
packs := make([]*resource.Pack, len(resources))
for i, entry := range resources {
packs[i], err = resource.Compile(filepath.Join(dir, entry.Name()))
packs[i], err = resource.ReadPath(filepath.Join(dir, entry.Name()))
if err != nil {
return nil, fmt.Errorf("compile resource (%v): %w", entry.Name(), err)
}
Expand Down
2 changes: 1 addition & 1 deletion server/internal/packbuilder/resource_pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func BuildResourcePack() (*resource.Pack, bool) {
copy(header[:], hash)
copy(module[:], hash[16:])
buildManifest(dir, header, module)
return resource.MustCompile(dir), true
return resource.MustReadPath(dir), true
}
return nil, false
}
Binary file modified server/item/creative/creative_items.nbt
Binary file not shown.
Binary file modified server/item/recipe/crafting_data.nbt
Binary file not shown.
15 changes: 11 additions & 4 deletions server/item/recipe/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,27 @@ type inputItems []struct {
Meta int32 `nbt:"meta"`
// Count is the amount of the item.
Count int32 `nbt:"count"`
// State is included if the output is a block. If it's not included, the meta can be discarded and the output item can be incorrect.
State struct {
Name string `nbt:"name"`
Properties map[string]interface{} `nbt:"states"`
Version int32 `nbt:"version"`
} `nbt:"block"`
}

// Stacks converts input items to item stacks.
func (d inputItems) Stacks() ([]item.Stack, bool) {
s := make([]item.Stack, 0, len(d))
for _, i := range d {
if len(i.Name) == 0 {
s = append(s, item.Stack{})
continue
}
it, ok := world.ItemByName(i.Name, int16(i.Meta))
if !ok {
return nil, false
}
if b, ok := world.BlockByName(i.State.Name, i.State.Properties); ok {
if it, ok = b.(world.Item); !ok {
return nil, false
}
}
st := item.NewStack(it, int(i.Count))
if i.Meta == math.MaxInt16 {
st = st.WithValue("variants", true)
Expand Down
Binary file modified server/item/recipe/smithing_data.nbt
Binary file not shown.
Binary file modified server/world/block_states.nbt
Binary file not shown.
Binary file modified server/world/item_runtime_ids.nbt
Binary file not shown.
4 changes: 4 additions & 0 deletions server/world/mcdb/leveldat/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ type Data struct {
PermissionsLevel int32 `nbt:"permissionsLevel"`
PlayerPermissionsLevel int32 `nbt:"playerPermissionsLevel"`
IsRandomSeedAllowed bool `nbt:"isRandomSeedAllowed"`
DoLimitedCrafting bool `nbt:"dolimitedcrafting"`
EditorWorldType int32 `nbt:"editorWorldType"`
PlayersSleepingPercentage int32 `nbt:"playerssleepingpercentage"`
RecipesUnlock bool `nbt:"recipesunlock"`
}

// FillDefault fills out d with all the default level.dat values.
Expand Down
Loading