Skip to content

Commit 6f0cd10

Browse files
authored
dragonfly: Updated for 1.21.124. (#1136)
1 parent 3f4cdb9 commit 6f0cd10

File tree

4 files changed

+33
-28
lines changed

4 files changed

+33
-28
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/go-gl/mathgl v1.2.0
1313
github.com/google/uuid v1.6.0
1414
github.com/pelletier/go-toml v1.9.5
15-
github.com/sandertv/gophertunnel v1.51.0
15+
github.com/sandertv/gophertunnel v1.51.1
1616
github.com/segmentio/fasthash v1.0.3
1717
golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329
1818
golang.org/x/mod v0.22.0
@@ -27,7 +27,7 @@ require (
2727
github.com/klauspost/compress v1.18.1 // indirect
2828
github.com/sandertv/go-raknet v1.14.3-0.20250305181847-6af3e95113d6 // indirect
2929
golang.org/x/net v0.38.0 // indirect
30-
golang.org/x/oauth2 v0.25.0 // indirect
30+
golang.org/x/oauth2 v0.27.0 // indirect
3131
golang.org/x/sync v0.12.0 // indirect
3232
gopkg.in/yaml.v2 v2.3.0 // indirect
3333
)

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
3939
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
4040
github.com/sandertv/go-raknet v1.14.3-0.20250305181847-6af3e95113d6 h1:ZfK7NCzIDE+dzp5x6NIO4JDLsjsOxi762CNR1Obds2Q=
4141
github.com/sandertv/go-raknet v1.14.3-0.20250305181847-6af3e95113d6/go.mod h1:/yysjwfCXm2+2OY8mBazLzcxJ3irnylKCyG3FLgUPVU=
42-
github.com/sandertv/gophertunnel v1.51.0 h1:16YmOR6AwtreQjbDynFD5kWt7sm+MwdCs79Yl7RGrPc=
43-
github.com/sandertv/gophertunnel v1.51.0/go.mod h1:IhLg93aMPY/rKgB7lKxTzOZ6i11OgkL0WinVs+gMvlI=
42+
github.com/sandertv/gophertunnel v1.51.1 h1:NTv8Yt8CI6Hg7xNOOP1b7mtqqScK1k+OPBlmxi+tIio=
43+
github.com/sandertv/gophertunnel v1.51.1/go.mod h1:IhLg93aMPY/rKgB7lKxTzOZ6i11OgkL0WinVs+gMvlI=
4444
github.com/segmentio/fasthash v1.0.3 h1:EI9+KE1EwvMLBWwjpRDc+fEM+prwxDYbslddQGtrmhM=
4545
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
4646
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
@@ -52,8 +52,8 @@ golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
5252
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
5353
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
5454
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
55-
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
56-
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
55+
golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
56+
golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
5757
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
5858
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
5959
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=

server/player/player.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2443,7 +2443,7 @@ func (p *Player) Tick(tx *world.Tx, current int64) {
24432443
}
24442444
}
24452445

2446-
p.session().SendDebugShapes()
2446+
p.session().SendDebugShapes(tx.World().Dimension())
24472447
p.session().SendHudUpdates()
24482448

24492449
if p.prevWorld != tx.World() && p.prevWorld != nil {

server/session/player.go

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -858,24 +858,24 @@ func (s *Session) RemoveAllDebugShapes() {
858858

859859
// SendDebugShapes sends any pending additions/removals of debug shapes to the player. Shapes should be sent
860860
// every tick to allow for batching and time-efficient updates.
861-
func (s *Session) SendDebugShapes() {
861+
func (s *Session) SendDebugShapes(dim world.Dimension) {
862862
s.debugShapesMu.Lock()
863863
defer s.debugShapesMu.Unlock()
864864

865865
if len(s.debugShapesAdd) == 0 && len(s.debugShapesRemove) == 0 {
866866
return
867867
}
868868

869-
shapes := make([]packet.DebugDrawerShape, 0, len(s.debugShapesAdd)+len(s.debugShapesRemove))
869+
shapes := make([]protocol.DebugDrawerShape, 0, len(s.debugShapesAdd)+len(s.debugShapesRemove))
870870
loop:
871871
for {
872872
select {
873873
case shape := <-s.debugShapesAdd:
874874
s.debugShapes[shape.ShapeID()] = shape
875-
shapes = append(shapes, s.debugShapeToProtocol(shape))
875+
shapes = append(shapes, s.debugShapeToProtocol(shape, dim))
876876
case id := <-s.debugShapesRemove:
877877
delete(s.debugShapes, id)
878-
shapes = append(shapes, packet.DebugDrawerShape{NetworkID: uint64(id)})
878+
shapes = append(shapes, protocol.DebugDrawerShape{NetworkID: uint64(id), DimensionID: s.dimensionID(dim)})
879879
default:
880880
break loop
881881
}
@@ -885,46 +885,51 @@ loop:
885885

886886
// debugShapeToProtocol converts a debug shape to its protocol representation. It also provides defaults
887887
// for some fields such as colour, scale and other per-shape properties.
888-
func (s *Session) debugShapeToProtocol(shape debug.Shape) packet.DebugDrawerShape {
889-
ps := packet.DebugDrawerShape{NetworkID: uint64(shape.ShapeID())}
888+
func (s *Session) debugShapeToProtocol(shape debug.Shape, dim world.Dimension) protocol.DebugDrawerShape {
889+
ps := protocol.DebugDrawerShape{
890+
NetworkID: uint64(shape.ShapeID()),
891+
DimensionID: s.dimensionID(dim),
892+
}
890893
white := color.RGBA{R: 255, G: 255, B: 255, A: 255}
891894
switch shape := shape.(type) {
892895
case *debug.Arrow:
893-
ps.Type = protocol.Option(uint8(packet.ScriptDebugShapeArrow))
896+
ps.Type = protocol.Option(uint8(protocol.DebugDrawerShapeArrow))
894897
ps.Colour = protocol.Option(valueOrDefault(shape.Colour, white))
895898
ps.Location = protocol.Option(vec64To32(shape.Position))
896-
ps.LineEndLocation = protocol.Option(vec64To32(shape.EndPosition))
897-
ps.ArrowHeadLength = protocol.Option(valueOrDefault(float32(shape.HeadLength), 1))
898-
ps.ArrowHeadRadius = protocol.Option(valueOrDefault(float32(shape.HeadRadius), 0.5))
899-
ps.Segments = protocol.Option(valueOrDefault(uint8(shape.HeadSegments), 4))
899+
ps.ExtraShapeData = &protocol.ArrowShape{
900+
ArrowEndLocation: protocol.Option(vec64To32(shape.EndPosition)),
901+
ArrowHeadLength: protocol.Option(valueOrDefault(float32(shape.HeadLength), 1)),
902+
ArrowHeadRadius: protocol.Option(valueOrDefault(float32(shape.HeadRadius), 0.5)),
903+
Segments: protocol.Option(valueOrDefault(uint8(shape.HeadSegments), 4)),
904+
}
900905
case *debug.Box:
901-
ps.Type = protocol.Option(uint8(packet.ScriptDebugShapeBox))
906+
ps.Type = protocol.Option(uint8(protocol.DebugDrawerShapeBox))
902907
ps.Colour = protocol.Option(valueOrDefault(shape.Colour, white))
903-
ps.BoxBound = protocol.Option(valueOrDefault(vec64To32(shape.Bounds), mgl32.Vec3{1, 1, 1}))
904908
ps.Location = protocol.Option(vec64To32(shape.Position))
905909
ps.Scale = protocol.Option(valueOrDefault(float32(shape.Scale), 1))
910+
ps.ExtraShapeData = &protocol.BoxShape{BoxBound: valueOrDefault(vec64To32(shape.Bounds), mgl32.Vec3{1, 1, 1})}
906911
case *debug.Circle:
907-
ps.Type = protocol.Option(uint8(packet.ScriptDebugShapeCircle))
912+
ps.Type = protocol.Option(uint8(protocol.DebugDrawerShapeCircle))
908913
ps.Colour = protocol.Option(valueOrDefault(shape.Colour, white))
909914
ps.Location = protocol.Option(vec64To32(shape.Position))
910915
ps.Scale = protocol.Option(valueOrDefault(float32(shape.Scale), 1))
911-
ps.Segments = protocol.Option(valueOrDefault(uint8(shape.Segments), 20))
916+
ps.ExtraShapeData = &protocol.SphereShape{Segments: valueOrDefault(uint8(shape.Segments), 20)}
912917
case *debug.Line:
913-
ps.Type = protocol.Option(uint8(packet.ScriptDebugShapeLine))
918+
ps.Type = protocol.Option(uint8(protocol.DebugDrawerShapeLine))
914919
ps.Colour = protocol.Option(valueOrDefault(shape.Colour, white))
915920
ps.Location = protocol.Option(vec64To32(shape.Position))
916-
ps.LineEndLocation = protocol.Option(vec64To32(shape.EndPosition))
921+
ps.ExtraShapeData = &protocol.LineShape{LineEndLocation: vec64To32(shape.EndPosition)}
917922
case *debug.Sphere:
918-
ps.Type = protocol.Option(uint8(packet.ScriptDebugShapeSphere))
923+
ps.Type = protocol.Option(uint8(protocol.DebugDrawerShapeSphere))
919924
ps.Colour = protocol.Option(valueOrDefault(shape.Colour, white))
920925
ps.Location = protocol.Option(vec64To32(shape.Position))
921926
ps.Scale = protocol.Option(valueOrDefault(float32(shape.Scale), 1))
922-
ps.Segments = protocol.Option(valueOrDefault(uint8(shape.Segments), 20))
927+
ps.ExtraShapeData = &protocol.SphereShape{Segments: valueOrDefault(uint8(shape.Segments), 20)}
923928
case *debug.Text:
924-
ps.Type = protocol.Option(uint8(packet.ScriptDebugShapeText))
929+
ps.Type = protocol.Option(uint8(protocol.DebugDrawerShapeText))
925930
ps.Colour = protocol.Option(valueOrDefault(shape.Colour, white))
926931
ps.Location = protocol.Option(vec64To32(shape.Position))
927-
ps.Text = protocol.Option(shape.Text)
932+
ps.ExtraShapeData = &protocol.TextShape{Text: shape.Text}
928933
default:
929934
panic(fmt.Sprintf("unknown debug shape type %T", shape))
930935
}

0 commit comments

Comments
 (0)