Skip to content

Commit

Permalink
dragonfly/server: Start support for 1.21.50
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedAsylumMC committed Nov 16, 2024
1 parent 16b4c61 commit 01c261b
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 16 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/go-gl/mathgl v1.1.0
github.com/google/uuid v1.6.0
github.com/pelletier/go-toml v1.9.5
github.com/sandertv/gophertunnel v1.42.2
github.com/sandertv/gophertunnel v1.42.3-0.20241116121323-39b816f98736
github.com/segmentio/fasthash v1.0.3
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
golang.org/x/mod v0.21.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sandertv/go-raknet v1.14.2 h1:UZLyHn5yQU2Dq2GVq/LlxwAUikaq4q4AA1rl/Pf3AXQ=
github.com/sandertv/go-raknet v1.14.2/go.mod h1:/yysjwfCXm2+2OY8mBazLzcxJ3irnylKCyG3FLgUPVU=
github.com/sandertv/gophertunnel v1.42.1-0.20241116110801-0d5e922316aa h1:uaS6WSi/VnS3qhx0GDO0nT35tG3vReXGs/vmOi9f5a4=
github.com/sandertv/gophertunnel v1.42.1-0.20241116110801-0d5e922316aa/go.mod h1:krvLSeRUNQ2iEYJNEgzrKtWO8W5ybZxN5lFfSCkHoNk=
github.com/sandertv/gophertunnel v1.42.2 h1:YWi4vAkq9IpNFIDxOrSMeGh2wkWMCMO8Kg45/R7VTQs=
github.com/sandertv/gophertunnel v1.42.2/go.mod h1:krvLSeRUNQ2iEYJNEgzrKtWO8W5ybZxN5lFfSCkHoNk=
github.com/sandertv/gophertunnel v1.42.3-0.20241116121323-39b816f98736 h1:02pOs3JknHXqMRK01NFrZl0R6UclyqLgHxi4mLPt2dE=
github.com/sandertv/gophertunnel v1.42.3-0.20241116121323-39b816f98736/go.mod h1:krvLSeRUNQ2iEYJNEgzrKtWO8W5ybZxN5lFfSCkHoNk=
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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
2 changes: 1 addition & 1 deletion server/internal/packbuilder/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func buildManifest(dir string, headerUUID, moduleUUID uuid.UUID) {
Header: resource.Header{
Name: "dragonfly auto-generated resource pack",
Description: "This resource pack contains auto-generated content from dragonfly",
UUID: headerUUID.String(),
UUID: headerUUID,
Version: [3]int{0, 0, 1},
MinimumGameVersion: parseVersion(protocol.CurrentVersion),
},
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/furnace_data.nbt
Binary file not shown.
28 changes: 14 additions & 14 deletions server/session/handler_player_auth_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ func (h PlayerAuthInputHandler) handleMovement(pk *packet.PlayerAuthInput, s *Se

// handleActions handles the actions with the world that are present in the PlayerAuthInput packet.
func (h PlayerAuthInputHandler) handleActions(pk *packet.PlayerAuthInput, s *Session) error {
if pk.InputData&packet.InputFlagPerformItemInteraction != 0 {
if pk.InputData.Test(packet.InputFlagPerformItemInteraction) {
if err := h.handleUseItemData(pk.ItemInteractionData, s); err != nil {
return err
}
}
if pk.InputData&packet.InputFlagPerformBlockActions != 0 {
if pk.InputData.Test(packet.InputFlagPerformBlockActions) {
if err := h.handleBlockActions(pk.BlockActions, s); err != nil {
return err
}
}
h.handleInputFlags(pk.InputData, s)

if pk.InputData&packet.InputFlagPerformItemStackRequest != 0 {
if pk.InputData.Test(packet.InputFlagPerformItemStackRequest) {
s.inTransaction.Store(true)
defer s.inTransaction.Store(false)

Expand All @@ -94,35 +94,35 @@ func (h PlayerAuthInputHandler) handleActions(pk *packet.PlayerAuthInput, s *Ses
}

// handleInputFlags handles the toggleable input flags set in a PlayerAuthInput packet.
func (h PlayerAuthInputHandler) handleInputFlags(flags uint64, s *Session) {
if flags&packet.InputFlagStartSprinting != 0 {
func (h PlayerAuthInputHandler) handleInputFlags(flags protocol.Bitset, s *Session) {
if flags.Test(packet.InputFlagStartSprinting) {
s.c.StartSprinting()
}
if flags&packet.InputFlagStopSprinting != 0 {
if flags.Test(packet.InputFlagStopSprinting) {
s.c.StopSprinting()
}
if flags&packet.InputFlagStartSneaking != 0 {
if flags.Test(packet.InputFlagStartSneaking) {
s.c.StartSneaking()
}
if flags&packet.InputFlagStopSneaking != 0 {
if flags.Test(packet.InputFlagStopSneaking) {
s.c.StopSneaking()
}
if flags&packet.InputFlagStartSwimming != 0 {
if flags.Test(packet.InputFlagStartSwimming) {
s.c.StartSwimming()
}
if flags&packet.InputFlagStopSwimming != 0 {
if flags.Test(packet.InputFlagStopSwimming) {
s.c.StopSwimming()
}
if flags&packet.InputFlagStartGliding != 0 {
if flags.Test(packet.InputFlagStartGliding) {
s.c.StartGliding()
}
if flags&packet.InputFlagStopGliding != 0 {
if flags.Test(packet.InputFlagStopGliding) {
s.c.StopGliding()
}
if flags&packet.InputFlagStartJumping != 0 {
if flags.Test(packet.InputFlagStartJumping) {
s.c.Jump()
}
if flags&packet.InputFlagMissedSwing != 0 {
if flags.Test(packet.InputFlagMissedSwing) {
s.swingingArm.Store(true)
defer s.swingingArm.Store(false)
s.c.PunchAir()
Expand Down
Binary file removed server/world/block_states.nbt
Binary file not shown.
Binary file modified server/world/item_runtime_ids.nbt
Binary file not shown.

0 comments on commit 01c261b

Please sign in to comment.