fix code format
This commit is contained in:
@ -13,11 +13,11 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Tnze/go-mc/data/packetid"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/Tnze/go-mc/data/packetid"
|
||||||
"github.com/Tnze/go-mc/net/CFB8"
|
"github.com/Tnze/go-mc/net/CFB8"
|
||||||
pk "github.com/Tnze/go-mc/net/packet"
|
pk "github.com/Tnze/go-mc/net/packet"
|
||||||
"github.com/Tnze/go-mc/yggdrasil/user"
|
"github.com/Tnze/go-mc/yggdrasil/user"
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package save
|
package save
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Tnze/go-mc/save/region"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/Tnze/go-mc/save/region"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestColumn(t *testing.T) {
|
func TestColumn(t *testing.T) {
|
||||||
|
@ -2,10 +2,11 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"github.com/Tnze/go-mc/server/auth"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"github.com/Tnze/go-mc/net"
|
"github.com/Tnze/go-mc/net"
|
||||||
|
"github.com/Tnze/go-mc/server/auth"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GamePlay interface {
|
type GamePlay interface {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package bvh
|
package bvh
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"golang.org/x/exp/constraints"
|
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
|
"golang.org/x/exp/constraints"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AABB[I constraints.Signed | constraints.Float, V interface {
|
type AABB[I constraints.Signed | constraints.Float, V interface {
|
||||||
@ -18,10 +19,12 @@ type AABB[I constraints.Signed | constraints.Float, V interface {
|
|||||||
func (aabb AABB[I, V]) WithIn(point V) bool {
|
func (aabb AABB[I, V]) WithIn(point V) bool {
|
||||||
return aabb.Lower.Less(point) && aabb.Upper.More(point)
|
return aabb.Lower.Less(point) && aabb.Upper.More(point)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aabb AABB[I, V]) Touch(other AABB[I, V]) bool {
|
func (aabb AABB[I, V]) Touch(other AABB[I, V]) bool {
|
||||||
return aabb.Lower.Less(other.Upper) && other.Lower.Less(aabb.Upper) &&
|
return aabb.Lower.Less(other.Upper) && other.Lower.Less(aabb.Upper) &&
|
||||||
aabb.Upper.More(other.Lower) && other.Upper.More(aabb.Lower)
|
aabb.Upper.More(other.Lower) && other.Upper.More(aabb.Lower)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aabb AABB[I, V]) Union(other AABB[I, V]) AABB[I, V] {
|
func (aabb AABB[I, V]) Union(other AABB[I, V]) AABB[I, V] {
|
||||||
return AABB[I, V]{Upper: aabb.Upper.Max(other.Upper), Lower: aabb.Lower.Min(other.Lower)}
|
return AABB[I, V]{Upper: aabb.Upper.Max(other.Upper), Lower: aabb.Lower.Min(other.Lower)}
|
||||||
}
|
}
|
||||||
@ -45,9 +48,11 @@ type Sphere[I constraints.Float, V interface {
|
|||||||
func (s Sphere[I, V]) WithIn(point V) bool {
|
func (s Sphere[I, V]) WithIn(point V) bool {
|
||||||
return s.Center.Sub(point).Norm() < s.R
|
return s.Center.Sub(point).Norm() < s.R
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Sphere[I, V]) Touch(other Sphere[I, V]) bool {
|
func (s Sphere[I, V]) Touch(other Sphere[I, V]) bool {
|
||||||
return s.Center.Sub(other.Center).Norm() < s.R+other.R
|
return s.Center.Sub(other.Center).Norm() < s.R+other.R
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Sphere[I, V]) Union(other Sphere[I, V]) Sphere[I, V] {
|
func (s Sphere[I, V]) Union(other Sphere[I, V]) Sphere[I, V] {
|
||||||
d := other.Center.Sub(s.Center).Norm()
|
d := other.Center.Sub(s.Center).Norm()
|
||||||
r1r2d := (s.R - other.R) / d
|
r1r2d := (s.R - other.R) / d
|
||||||
|
@ -58,9 +58,9 @@ func TestTree2_Find_vec(t *testing.T) {
|
|||||||
t.Log(find(TouchPoint[Vec2d, AABBVec2d](Vec2d{1.5, 1.5})))
|
t.Log(find(TouchPoint[Vec2d, AABBVec2d](Vec2d{1.5, 1.5})))
|
||||||
t.Log(find(TouchPoint[Vec2d, AABBVec2d](Vec2d{-1.5, 0})))
|
t.Log(find(TouchPoint[Vec2d, AABBVec2d](Vec2d{-1.5, 0})))
|
||||||
|
|
||||||
t.Log(find(TouchBound[AABBVec2d](AABBVec2d{Upper: Vec2d{1, 1}, Lower: Vec2d{-1, -1}})))
|
t.Log(find(TouchBound(AABBVec2d{Upper: Vec2d{1, 1}, Lower: Vec2d{-1, -1}})))
|
||||||
t.Log(find(TouchBound[AABBVec2d](AABBVec2d{Upper: Vec2d{1, 1}, Lower: Vec2d{1.5, 1.5}})))
|
t.Log(find(TouchBound(AABBVec2d{Upper: Vec2d{1, 1}, Lower: Vec2d{1.5, 1.5}})))
|
||||||
t.Log(find(TouchBound[AABBVec2d](AABBVec2d{Upper: Vec2d{-1.5, 0.5}, Lower: Vec2d{-2.5, -0.5}})))
|
t.Log(find(TouchBound(AABBVec2d{Upper: Vec2d{-1.5, 0.5}, Lower: Vec2d{-2.5, -0.5}})))
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkTree_Insert(b *testing.B) {
|
func BenchmarkTree_Insert(b *testing.B) {
|
||||||
|
@ -4,8 +4,9 @@ import (
|
|||||||
"container/list"
|
"container/list"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/Tnze/go-mc/chat"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/Tnze/go-mc/chat"
|
||||||
)
|
)
|
||||||
|
|
||||||
// keepAliveInterval represents the interval when the server sends keep alive
|
// keepAliveInterval represents the interval when the server sends keep alive
|
||||||
|
@ -2,6 +2,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Tnze/go-mc/chat"
|
"github.com/Tnze/go-mc/chat"
|
||||||
"github.com/Tnze/go-mc/data/packetid"
|
"github.com/Tnze/go-mc/data/packetid"
|
||||||
"github.com/Tnze/go-mc/net"
|
"github.com/Tnze/go-mc/net"
|
||||||
|
@ -28,14 +28,17 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"log"
|
||||||
|
|
||||||
"github.com/Tnze/go-mc/data/packetid"
|
"github.com/Tnze/go-mc/data/packetid"
|
||||||
"github.com/Tnze/go-mc/net"
|
"github.com/Tnze/go-mc/net"
|
||||||
pk "github.com/Tnze/go-mc/net/packet"
|
pk "github.com/Tnze/go-mc/net/packet"
|
||||||
"log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const ProtocolName = "1.19.2"
|
const (
|
||||||
const ProtocolVersion = 760
|
ProtocolName = "1.19.2"
|
||||||
|
ProtocolVersion = 760
|
||||||
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
*log.Logger
|
*log.Logger
|
||||||
|
Reference in New Issue
Block a user