1.18 update for bot/server
This commit is contained in:
@ -20,6 +20,7 @@ type WorldInfo struct {
|
|||||||
HashedSeed int64 // First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
|
HashedSeed int64 // First 8 bytes of the SHA-256 hash of the world's seed. Used client side for biome noise
|
||||||
MaxPlayers int32 // Was once used by the client to draw the player list, but now is ignored.
|
MaxPlayers int32 // Was once used by the client to draw the player list, but now is ignored.
|
||||||
ViewDistance int32 // Render distance (2-32).
|
ViewDistance int32 // Render distance (2-32).
|
||||||
|
SimulationDistance int32 // The distance that the client will process specific things, such as entities.
|
||||||
ReducedDebugInfo bool // If true, a Notchian client shows reduced information on the debug screen. For servers in development, this should almost always be false.
|
ReducedDebugInfo bool // If true, a Notchian client shows reduced information on the debug screen. For servers in development, this should almost always be false.
|
||||||
EnableRespawnScreen bool // Set to false when the doImmediateRespawn gamerule is true.
|
EnableRespawnScreen bool // Set to false when the doImmediateRespawn gamerule is true.
|
||||||
IsDebug bool // True if the world is a debug mode world; debug mode worlds cannot be modified and have predefined blocks.
|
IsDebug bool // True if the world is a debug mode world; debug mode worlds cannot be modified and have predefined blocks.
|
||||||
@ -54,6 +55,7 @@ func (p *Player) handleJoinGamePacket(packet pk.Packet) error {
|
|||||||
(*pk.Long)(&p.HashedSeed),
|
(*pk.Long)(&p.HashedSeed),
|
||||||
(*pk.VarInt)(&p.MaxPlayers),
|
(*pk.VarInt)(&p.MaxPlayers),
|
||||||
(*pk.VarInt)(&p.ViewDistance),
|
(*pk.VarInt)(&p.ViewDistance),
|
||||||
|
(*pk.VarInt)(&p.SimulationDistance),
|
||||||
(*pk.Boolean)(&p.ReducedDebugInfo),
|
(*pk.Boolean)(&p.ReducedDebugInfo),
|
||||||
(*pk.Boolean)(&p.EnableRespawnScreen),
|
(*pk.Boolean)(&p.EnableRespawnScreen),
|
||||||
(*pk.Boolean)(&p.IsDebug),
|
(*pk.Boolean)(&p.IsDebug),
|
||||||
|
@ -150,6 +150,7 @@ func (m *MyServer) joinGame(conn *net.Conn) error {
|
|||||||
pk.Long(0), // Hashed Seed
|
pk.Long(0), // Hashed Seed
|
||||||
pk.VarInt(m.Settings.MaxPlayer), // Max Players
|
pk.VarInt(m.Settings.MaxPlayer), // Max Players
|
||||||
pk.VarInt(15), // View Distance
|
pk.VarInt(15), // View Distance
|
||||||
|
pk.VarInt(15), // Simulation Distance
|
||||||
pk.Boolean(false), // Reduced Debug Info
|
pk.Boolean(false), // Reduced Debug Info
|
||||||
pk.Boolean(true), // Enable respawn screen
|
pk.Boolean(true), // Enable respawn screen
|
||||||
pk.Boolean(false), // Is Debug
|
pk.Boolean(false), // Is Debug
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/Tnze/go-mc/chat"
|
"github.com/Tnze/go-mc/chat"
|
||||||
|
"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"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
@ -32,14 +33,14 @@ func (s *Server) acceptListPing(conn *net.Conn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch p.ID {
|
switch p.ID {
|
||||||
case 0x00: //List
|
case packetid.ServerInfo: //List
|
||||||
var resp []byte
|
var resp []byte
|
||||||
resp, err = s.listResp()
|
resp, err = s.listResp()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
err = conn.WritePacket(pk.Marshal(0x00, pk.String(resp)))
|
err = conn.WritePacket(pk.Marshal(0x00, pk.String(resp)))
|
||||||
case 0x01: //Ping
|
case packetid.PingClientbound: //Ping
|
||||||
err = conn.WritePacket(p)
|
err = conn.WritePacket(p)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user