diff options
| -rw-r--r-- | classic/ext_custom_blocks.go | 8 | ||||
| -rw-r--r-- | classic/packets.go | 1 | ||||
| -rw-r--r-- | server/server.go | 11 |
3 files changed, 20 insertions, 0 deletions
diff --git a/classic/ext_custom_blocks.go b/classic/ext_custom_blocks.go new file mode 100644 index 0000000..f19c2f8 --- /dev/null +++ b/classic/ext_custom_blocks.go @@ -0,0 +1,8 @@ +package classic + +type CustomBlocksSupportLevel struct { + SupportLevel byte +} +func (p *CustomBlocksSupportLevel) PacketId() byte { + return 0x13 +} diff --git a/classic/packets.go b/classic/packets.go index e361399..0e55429 100644 --- a/classic/packets.go +++ b/classic/packets.go @@ -200,6 +200,7 @@ func createPacketType(packetId byte, client bool, ext map[string]bool) Packet { case 0x0f: return &UpdateUserType {} case 0x10: return &ExtInfo {} case 0x11: return &ExtEntry {} + case 0x13: return &CustomBlocksSupportLevel {} default: return nil } } diff --git a/server/server.go b/server/server.go index a7a08ca..bc12b5f 100644 --- a/server/server.go +++ b/server/server.go @@ -20,10 +20,12 @@ var supportedExtensions = []string { "HackControl", "LongerMessages", "FullCP437", + "CustomBlocks", } var requiredExtensions = []string { "ExtEntityPositions", "EnvMapAspect.2", + "CustomBlocks", } type ServerInfo struct { @@ -502,6 +504,15 @@ func (cl *client) cpeHandshake(conn net.Conn, ext map[string]bool) bool { cl.disconnect("Missing required extension: " + req) } } + + err = classic.WritePacket(conn, &classic.CustomBlocksSupportLevel { + SupportLevel: 1, + }) + if cl.handleError(err) != nil { + return false + } + // it doesn't matter what the client sends in response to this + cl.extensions = ext return true } |
