From 68517e8ae12be8b352b579776525a7e19038e332 Mon Sep 17 00:00:00 2001 From: Ruphane <24724395+LNSSPsd@users.noreply.github.com> Date: Sat, 7 Jan 2023 19:31:17 -0800 Subject: [PATCH 1/6] Fix #171 Through Idk why there would be responses w/o valid `tag_name` JSON property from GitHub. That issue could not be easily reproduced. --- fastbuilder/utils/utils.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fastbuilder/utils/utils.go b/fastbuilder/utils/utils.go index 67629ec04..adf4965ac 100644 --- a/fastbuilder/utils/utils.go +++ b/fastbuilder/utils/utils.go @@ -62,6 +62,10 @@ func CheckUpdate(currentVersion string) (bool, string) { fmt.Printf("Failed to check update due to invalid response received from GitHub.\n") return false, "" } - version:=json_structure["tag_name"].(string) + version, err:=json_structure["tag_name"].(string) + if err!=nil { + fmt.Printf("Unknown error occured while checking the update\n") + return false, "" + } return C.compareVersion(C.CString(version[1:]),C.CString(currentVersion))!=0, version[1:] } \ No newline at end of file From ff57e8697d1fae19acb0a323c4a2ce53bb204f83 Mon Sep 17 00:00:00 2001 From: Ruphane <24724395+LNSSPsd@users.noreply.github.com> Date: Sat, 7 Jan 2023 19:38:52 -0800 Subject: [PATCH 2/6] No client-performed DisplayName checking (#169) --- minecraft/protocol/login/data.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/minecraft/protocol/login/data.go b/minecraft/protocol/login/data.go index 847d5d662..736444bf2 100644 --- a/minecraft/protocol/login/data.go +++ b/minecraft/protocol/login/data.go @@ -62,6 +62,11 @@ func (data IdentityData) Validate() error { if id, err := uuid.Parse(data.Identity); err != nil || id == uuid.Nil { return fmt.Errorf("UUID must be parseable as a valid UUID, but got %v", data.Identity) } + // NetEase's rule for DisplayName is different, where unicode characters + // were enabled to use. We are not going to open a server as it's not + // possible for NetEase's Minecraft, so these checks below could be + // ignored. + return nil if len(data.DisplayName) == 0 || len(data.DisplayName) > 15 { return fmt.Errorf("DisplayName must not be empty or longer than 15 characters, but got %v characters", len(data.DisplayName)) } From fabf48700fe4c38682fa7d1ab1f2da0b4b733c8d Mon Sep 17 00:00:00 2001 From: Ruphane <24724395+LNSSPsd@users.noreply.github.com> Date: Sat, 7 Jan 2023 19:42:32 -0800 Subject: [PATCH 3/6] Stop hardcoded usage for unused palette of bdump --- fastbuilder/bdump/bdump_legacy.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fastbuilder/bdump/bdump_legacy.go b/fastbuilder/bdump/bdump_legacy.go index f601e7f15..a05170916 100644 --- a/fastbuilder/bdump/bdump_legacy.go +++ b/fastbuilder/bdump/bdump_legacy.go @@ -104,14 +104,7 @@ func (bdump *BDumpLegacy) writeHeader(w *bytes.Buffer) error { return err } _, err = w.Write([]byte{0}) - if err != nil { - return err - } - // 写入作者之名 - // 注:现在不再写入作者信息 - _, err = w.Write([]byte{0x1f, 0x75}) return err - // 放置容器需要用到 117 号的 RunTimeId 调色板表 } func (bdump *BDumpLegacy) writeBlocks(w *bytes.Buffer) error { From 14304a59b82643f3f9c4a2d0c16c264a25bd1e12 Mon Sep 17 00:00:00 2001 From: Ruphane <24724395+LNSSPsd@users.noreply.github.com> Date: Sat, 7 Jan 2023 19:45:45 -0800 Subject: [PATCH 4/6] Fix type error --- fastbuilder/utils/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastbuilder/utils/utils.go b/fastbuilder/utils/utils.go index adf4965ac..bbfba0e02 100644 --- a/fastbuilder/utils/utils.go +++ b/fastbuilder/utils/utils.go @@ -62,8 +62,8 @@ func CheckUpdate(currentVersion string) (bool, string) { fmt.Printf("Failed to check update due to invalid response received from GitHub.\n") return false, "" } - version, err:=json_structure["tag_name"].(string) - if err!=nil { + version, found_tag_name_item:=json_structure["tag_name"].(string) + if !found_tag_name_item { fmt.Printf("Unknown error occured while checking the update\n") return false, "" } From 38965510291919ae2d40474f57243c345d1468f5 Mon Sep 17 00:00:00 2001 From: Ruphane <24724395+LNSSPsd@users.noreply.github.com> Date: Sat, 7 Jan 2023 19:52:01 -0800 Subject: [PATCH 5/6] Suppress packet parsing error output --- minecraft/dial.go | 2 +- minecraft/packet.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/minecraft/dial.go b/minecraft/dial.go index 4a5075fce..822180cc7 100644 --- a/minecraft/dial.go +++ b/minecraft/dial.go @@ -168,7 +168,7 @@ func (d Dialer) DialContext(ctx context.Context, network string) (conn *Conn, er request = login.Encode(chainData, conn.clientData, key) identityData, _, _, err := login.Parse(request) if err!=nil { - fmt.Printf("WARNING: Identity data parsing error: %w\n", err) + fmt.Printf("WARNING: Identity data parsing error: %w\n", err.(error)) } // If we got the identity data from Minecraft auth, we need to make sure we set it in the Conn too, as // we are not aware of the identity data ourselves yet. diff --git a/minecraft/packet.go b/minecraft/packet.go index 08bbfa6f6..ea7ed8e41 100644 --- a/minecraft/packet.go +++ b/minecraft/packet.go @@ -44,7 +44,8 @@ func (p *packetData) decode(conn *Conn) (pk packet.Packet, err error) { r := protocol.NewReader(p.payload, conn.shieldID.Load()) defer func() { if recoveredErr := recover(); recoveredErr != nil { - err = fmt.Errorf("%T: %w", pk, recoveredErr.(error)) + // + //err = fmt.Errorf("%T: %w", pk, recoveredErr.(error)) } }() pk.Unmarshal(r) From 09a7ef5115b97de30237948c120c417eefe0ec4e Mon Sep 17 00:00:00 2001 From: Ruphane <24724395+LNSSPsd@users.noreply.github.com> Date: Sat, 7 Jan 2023 19:53:05 -0800 Subject: [PATCH 6/6] Update version to 4.9.95002 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index e599f35eb..a5965e598 100644 --- a/version +++ b/version @@ -1 +1 @@ -4.9.95001 \ No newline at end of file +4.9.95002