accidentally regen again and block state early work
This commit is contained in:
@@ -66,3 +66,13 @@ func LookupBlockByStateId(version string, stateId int32) (block Block, ok bool)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func LookupBlockByName(version string, stateId int32) (block Block, ok bool) {
|
||||
for _, b := range BlocksForVersion(version) {
|
||||
if b.MinStateId <= stateId && stateId <= b.MaxStateId {
|
||||
block = b
|
||||
ok = true
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
go test fuzz v1
|
||||
[]byte("")
|
||||
File diff suppressed because one or more lines are too long
+12129
-12129
File diff suppressed because it is too large
Load Diff
+9248
-9248
File diff suppressed because it is too large
Load Diff
+11664
-11664
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,7 @@ var StatusResponse = server.StatusResponse{
|
||||
type Server struct {
|
||||
*proto.Conn
|
||||
*client.Timer
|
||||
MinCycle, MaxCycle, Current int32
|
||||
}
|
||||
|
||||
var packet = &v1_21_8.PlayToClientPacketMapChunk{X: 0, Z: 0, Heightmaps: []struct {
|
||||
@@ -82,7 +83,7 @@ func (s *Server) OnStart(_ event.OnStart) (err error) {
|
||||
err = s.Send(&v1_21_8.PlayToClientPacketPosition{
|
||||
TeleportId: 0,
|
||||
X: 0,
|
||||
Y: 64,
|
||||
Y: -60,
|
||||
Z: 0,
|
||||
Dx: 0,
|
||||
Dy: 0,
|
||||
@@ -123,6 +124,7 @@ func (s *Server) OnStart(_ event.OnStart) (err error) {
|
||||
return
|
||||
}
|
||||
s.Timer.Every(time.Second*15, s.SendKeepAlive)
|
||||
s.Timer.Every(time.Second, s.CycleBlockForTesting)
|
||||
s.Timer.Active = true
|
||||
return
|
||||
}
|
||||
@@ -132,22 +134,34 @@ func (s *Server) OnTick(_ event.Tick) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Server) CycleBlockForTesting() (err error) {
|
||||
err = s.Send(&v1_21_8.PlayToClientPacketBlockChange{
|
||||
Location: v1_21_8.Position{
|
||||
X: 1,
|
||||
Z: 1,
|
||||
Y: -60,
|
||||
},
|
||||
Type: s.Current,
|
||||
})
|
||||
s.Current++
|
||||
if s.Current > s.MaxCycle {
|
||||
s.Current = s.MinCycle
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Server) SendKeepAlive() (err error) {
|
||||
err = s.Send(&v1_21_8.PlayToClientPacketKeepAlive{KeepAliveId: rand.Int64()})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = s.Send(&v1_21_8.PlayToClientPacketBlockChange{
|
||||
Location: v1_21_8.Position{},
|
||||
Type: 0,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func main() {
|
||||
slog.SetLogLoggerLevel(slog.LevelDebug)
|
||||
err := server.StartServerWithFactory(":25565", func(c *proto.Conn) (h any, err error) {
|
||||
s := &Server{Conn: c}
|
||||
s := &Server{Conn: c, MinCycle: 2938, MaxCycle: 3017, Current: 2938}
|
||||
s.Timer = &client.Timer{}
|
||||
h = s
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user