diff --git a/go.mod b/go.mod index 2ddcd82da..5cf86efd2 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 8f4496d7c..dc708b465 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/server/block/flower.go b/server/block/flower.go index 55f7b1a1a..be848e53c 100644 --- a/server/block/flower.go +++ b/server/block/flower.go @@ -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 ... diff --git a/server/block/flower_type.go b/server/block/flower_type.go index a5a7d1082..10c14a237 100644 --- a/server/block/flower_type.go +++ b/server/block/flower_type.go @@ -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: diff --git a/server/block/sign.go b/server/block/sign.go index ef45b8722..fe65be77e 100644 --- a/server/block/sign.go +++ b/server/block/sign.go @@ -6,6 +6,7 @@ import ( "github.com/df-mc/dragonfly/server/item" "github.com/df-mc/dragonfly/server/world" "github.com/df-mc/dragonfly/server/world/particle" + "github.com/df-mc/dragonfly/server/world/sound" "github.com/go-gl/mathgl/mgl64" "image/color" "strings" @@ -119,9 +120,11 @@ func (s Sign) Wax(cube.Pos, mgl64.Vec3) (world.Block, bool) { } // Activate ... -func (s Sign) Activate(pos cube.Pos, _ cube.Face, _ *world.World, user item.User, _ *item.UseContext) bool { +func (s Sign) Activate(pos cube.Pos, _ cube.Face, w *world.World, user item.User, _ *item.UseContext) bool { if editor, ok := user.(SignEditor); ok && !s.Waxed { editor.OpenSign(pos, s.EditingFrontSide(pos, user.Position())) + } else if s.Waxed { + w.PlaySound(pos.Vec3(), sound.WaxedSignFailedInteraction{}) } return true } diff --git a/server/item/creative/creative_items.nbt b/server/item/creative/creative_items.nbt index 1498955a7..8cb2f4c02 100644 Binary files a/server/item/creative/creative_items.nbt and b/server/item/creative/creative_items.nbt differ diff --git a/server/item/honeycomb.go b/server/item/honeycomb.go index e1f6bd2ff..807888e37 100644 --- a/server/item/honeycomb.go +++ b/server/item/honeycomb.go @@ -3,6 +3,7 @@ package item import ( "github.com/df-mc/dragonfly/server/block/cube" "github.com/df-mc/dragonfly/server/world" + "github.com/df-mc/dragonfly/server/world/sound" "github.com/go-gl/mathgl/mgl64" ) @@ -15,6 +16,7 @@ func (Honeycomb) UseOnBlock(pos cube.Pos, _ cube.Face, _ mgl64.Vec3, w *world.Wo if wa, ok := w.Block(pos).(waxable); ok { if res, ok := wa.Wax(pos, user.Position()); ok { w.SetBlock(pos, res, nil) + w.PlaySound(pos.Vec3(), sound.SignWaxed{}) ctx.SubtractFromCount(1) return true } diff --git a/server/item/recipe/crafting_data.nbt b/server/item/recipe/crafting_data.nbt index 60cfabf5c..0139383bb 100644 Binary files a/server/item/recipe/crafting_data.nbt and b/server/item/recipe/crafting_data.nbt differ diff --git a/server/item/recipe/smithing_data.nbt b/server/item/recipe/smithing_data.nbt index eb0deadad..f101dbb30 100644 Binary files a/server/item/recipe/smithing_data.nbt and b/server/item/recipe/smithing_data.nbt differ diff --git a/server/item/recipe/stonecutter_data.nbt b/server/item/recipe/stonecutter_data.nbt deleted file mode 100644 index 1db76b81c..000000000 Binary files a/server/item/recipe/stonecutter_data.nbt and /dev/null differ diff --git a/server/item/recipe/vanilla.go b/server/item/recipe/vanilla.go index 20203e760..af3a9dd07 100644 --- a/server/item/recipe/vanilla.go +++ b/server/item/recipe/vanilla.go @@ -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. @@ -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) { input, ok := s.Input.Items() output, okTwo := s.Output.Stacks() if !ok || !okTwo { diff --git a/server/session/enchantment_texts.go b/server/session/enchantment_texts.go index ac07e826b..0bb15c49d 100644 --- a/server/session/enchantment_texts.go +++ b/server/session/enchantment_texts.go @@ -4,4 +4,4 @@ package session // enchantNames are names translated to the 'Standard Galactic Alphabet' client-side. The names generally have no meaning // on the vanilla server implementation, so we can sneak some easter eggs in here without anyone noticing. -var enchantNames = []string{"abimek", "aericio", "aimjel", "alvin0319", "andreas hgk", "atm85", "blackjack200", "da pig guy", "daft0175", "deniel world", "didntpot", "eminarican", "endermanbugzjfc", "flonja", "hashim the arab", "hochbaum", "hyper flare mc", "im da real ani", "its zodia x", "ivan craft623", "javier leon9966", "just tal develops", "liatoast", "mmm545", "mohamed587100", "myma qc", "neutronic mc", "nonono697", "provsalt", "restart fu", "riccskn", "robertdudaa", "royal mcpe", "sallypemdas", "sandertv", "sculas", "sqmatheus", "ssaini123456", "t14 raptor", "tadhunt", "thunder33345", "tristanmorgan", "twisted asylum mc", "unickorn", "unknown ore", "uramnoil", "wqrro", "x natsuri", "x4caa", "xd-pro"} +var enchantNames = []string{"abimek", "aericio", "aimjel", "alvin0319", "andreas hgk", "atm85", "blackjack200", "da pig guy", "daft0175", "deniel world", "didntpot", "eminarican", "endermanbugzjfc", "erkam246", "flonja", "hashim the arab", "hochbaum", "hyper flare mc", "im da real ani", "its zodia x", "ivan craft623", "javier leon9966", "just tal develops", "liatoast", "mmm545", "mohamed587100", "myma qc", "neutronic mc", "nonono697", "provsalt", "restart fu", "riccskn", "robertdudaa", "royal mcpe", "sallypemdas", "sandertv", "sculas", "sqmatheus", "ssaini123456", "t14 raptor", "tadhunt", "thunder33345", "tristanmorgan", "twisted asylum mc", "unickorn", "unknown ore", "uramnoil", "wqrro", "x natsuri", "x4caa", "xd-pro"} diff --git a/server/session/handler_crafting.go b/server/session/handler_crafting.go index 26aec3235..a17133775 100644 --- a/server/session/handler_crafting.go +++ b/server/session/handler_crafting.go @@ -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 { diff --git a/server/session/world.go b/server/session/world.go index bae408fea..18d9deab5 100644 --- a/server/session/world.go +++ b/server/session/world.go @@ -526,6 +526,13 @@ func (s *Session) playSound(pos mgl64.Vec3, t world.Sound, disableRelative bool) Position: vec64To32(pos), }) return + case sound.SignWaxed: + s.writePacket(&packet.LevelEvent{ + EventType: packet.LevelEventWaxOn, + Position: vec64To32(pos), + }) + case sound.WaxedSignFailedInteraction: + pk.SoundType = packet.SoundEventWaxedSignInteractFail case sound.Pop: s.writePacket(&packet.LevelEvent{ EventType: packet.LevelEventSoundInfinityArrowPickup, diff --git a/server/world/block_states.nbt b/server/world/block_states.nbt index c1cbd97c2..83c833fa3 100644 Binary files a/server/world/block_states.nbt and b/server/world/block_states.nbt differ diff --git a/server/world/item_runtime_ids.nbt b/server/world/item_runtime_ids.nbt index aef793236..7fdf69bc1 100644 Binary files a/server/world/item_runtime_ids.nbt and b/server/world/item_runtime_ids.nbt differ diff --git a/server/world/mcdb/leveldat/data.go b/server/world/mcdb/leveldat/data.go index 24713aca7..a944f95ae 100644 --- a/server/world/mcdb/leveldat/data.go +++ b/server/world/mcdb/leveldat/data.go @@ -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. diff --git a/server/world/sound/block.go b/server/world/sound/block.go index 363d9d737..4fcc55544 100644 --- a/server/world/sound/block.go +++ b/server/world/sound/block.go @@ -182,6 +182,12 @@ type ComposterReady struct{ sound } // LecternBookPlace is a sound played when a book is placed in a lectern. type LecternBookPlace struct{ sound } +// SignWaxed is a sound played when a sign is waxed. +type SignWaxed struct{ sound } + +// WaxedSignFailedInteraction is a sound played when a player tries to interact with a waxed sign. +type WaxedSignFailedInteraction struct{ sound } + // sound implements the world.Sound interface. type sound struct{}