Skip to content

Commit

Permalink
dragonfly/server: Update to 1.20.80, fix recipes (#864) & nbt items i…
Browse files Browse the repository at this point in the history
…n creative inventory (#863)
  • Loading branch information
TwistedAsylumMC committed Apr 27, 2024
1 parent 55fee47 commit 223f136
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 31 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/google/uuid v1.4.0
github.com/pelletier/go-toml v1.9.5
github.com/rogpeppe/go-internal v1.11.0
github.com/sandertv/gophertunnel v1.36.0
github.com/sandertv/gophertunnel v1.37.0
github.com/segmentio/fasthash v1.0.3
github.com/sirupsen/logrus v1.9.3
golang.org/x/exp v0.0.0-20230206171751-46f607a40771
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
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.36.0 h1:VF2znM3FFUkPqOVnOeH0KgM5iI167AzSB2oqLxrn2F4=
github.com/sandertv/gophertunnel v1.36.0/go.mod h1:4El8ZfEpUmOMIJhPt5SCc1PyLNiuQ2+grWczrBvSGVs=
github.com/sandertv/gophertunnel v1.37.0 h1:yPzOp4W1GahLjtxldXa5K25saJK/XG7SiyEt6oMjm0I=
github.com/sandertv/gophertunnel v1.37.0/go.mod h1:4El8ZfEpUmOMIJhPt5SCc1PyLNiuQ2+grWczrBvSGVs=
github.com/segmentio/fasthash v1.0.3 h1:EI9+KE1EwvMLBWwjpRDc+fEM+prwxDYbslddQGtrmhM=
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand Down
14 changes: 2 additions & 12 deletions server/block/flower.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,12 @@ func (Flower) CompostChance() float64 {

// EncodeItem ...
func (f Flower) EncodeItem() (name string, meta int16) {
if f.Type == Dandelion() {
return "minecraft:yellow_flower", 0
} else if f.Type == WitherRose() {
return "minecraft:wither_rose", 0
}
return "minecraft:red_flower", int16(f.Type.Uint8() - 1)
return "minecraft:" + f.Type.String(), 0
}

// EncodeBlock ...
func (f Flower) EncodeBlock() (string, map[string]any) {
if f.Type == Dandelion() {
return "minecraft:yellow_flower", nil
} else if f.Type == WitherRose() {
return "minecraft:wither_rose", nil
}
return "minecraft:red_flower", map[string]any{"flower_type": f.Type.String()}
return "minecraft:" + f.Type.String(), nil
}

// allFlowers ...
Expand Down
16 changes: 8 additions & 8 deletions server/block/flower_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,25 @@ func (f flower) Name() string {
func (f flower) String() string {
switch f {
case 0:
return "dandelion"
return "yellow_flower"
case 1:
return "poppy"
case 2:
return "orchid"
return "blue_orchid"
case 3:
return "allium"
case 4:
return "houstonia"
return "azure_bluet"
case 5:
return "tulip_red"
return "red_tulip"
case 6:
return "tulip_orange"
return "orange_tulip"
case 7:
return "tulip_white"
return "white_tulip"
case 8:
return "tulip_pink"
return "pink_tulip"
case 9:
return "oxeye"
return "oxeye_daisy"
case 10:
return "cornflower"
case 11:
Expand Down
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.
Binary file modified server/item/recipe/smithing_data.nbt
Binary file not shown.
Binary file removed server/item/recipe/stonecutter_data.nbt
Binary file not shown.
9 changes: 1 addition & 8 deletions server/item/recipe/vanilla.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ var (
vanillaCraftingData []byte
//go:embed smithing_data.nbt
vanillaSmithingData []byte
//go:embed stonecutter_data.nbt
vanillaStonecutterData []byte
)

// shapedRecipe is a recipe that must be crafted in a specific shape.
Expand Down Expand Up @@ -44,12 +42,7 @@ func init() {
panic(err)
}

var stonecutterRecipes []shapelessRecipe
if err := nbt.Unmarshal(vanillaStonecutterData, &stonecutterRecipes); err != nil {
panic(err)
}

for _, s := range append(craftingRecipes.Shapeless, stonecutterRecipes...) {
for _, s := range append(craftingRecipes.Shapeless) {

Check failure on line 45 in server/item/recipe/vanilla.go

View workflow job for this annotation

GitHub Actions / Build

x = append(y) is equivalent to x = y (SA4021)
input, ok := s.Input.Items()
output, okTwo := s.Output.Stacks()
if !ok || !okTwo {
Expand Down
3 changes: 3 additions & 0 deletions server/session/handler_crafting.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ func matchingStacks(has, expected recipe.Item) bool {
switch expected := expected.(type) {
case item.Stack:
switch has := has.(type) {
case recipe.ItemTag:
name, _ := expected.Item().EncodeItem()
return has.Contains(name)
case item.Stack:
_, variants := expected.Value("variants")
if !variants {
Expand Down
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.
1 change: 1 addition & 0 deletions server/world/mcdb/leveldat/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ type Data struct {
NaturalGeneration bool `nbt:"naturalgeneration"`
ProjectilesCanBreakBlocks bool `nbt:"projectilescanbreakblocks"`
ShowRecipeMessages bool `nbt:"showrecipemessages"`
IsHardcore bool `nbt:"IsHardcore"`
}

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

0 comments on commit 223f136

Please sign in to comment.