From 9c13ca78f0b2aa451016b0ac5a8d53cb11085db5 Mon Sep 17 00:00:00 2001 From: Niek Vincent Date: Mon, 23 Oct 2023 18:18:05 +0200 Subject: [PATCH] Changed the enum values to match official naming Changed the enumerator names to match the internal naming used in the game code, added JavaDoc comments with a human friendly naming and included a lower boundary check for the BuildPlatform.from method --- .../protocol/bedrock/data/BuildPlatform.java | 37 ++++++++++++++++--- .../bedrock/data/UserInterfaceProfile.java | 3 +- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/BuildPlatform.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/BuildPlatform.java index dc8251394..9fa59582c 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/BuildPlatform.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/BuildPlatform.java @@ -3,24 +3,49 @@ public enum BuildPlatform { UNDEFINED, - ANDROID, + /** + * Android + */ + GOOGLE, IOS, + /** + * Mac OS + */ OSX, + /** + * Kindle, FireTV + */ AMAZON, GEAR_VR, HOLOLENS, + /** + * Windows Store version + */ UWP, + /** + * Educational edition + */ WIN_32, DEDICATED, - APPLE_TV, - PLAYSTATION, - NINTENDO_SWITCH, + /** + * Apple TV + */ + TV_OS, + /** + * Playstation + */ + SONY, + /** + * Nintendo Switch + */ + NX, XBOX, - WINDOWS_PHONE; + WINDOWS_PHONE, + LINUX; private static final BuildPlatform[] VALUES = values(); public static BuildPlatform from(int id) { - return id < VALUES.length ? VALUES[id] : VALUES[0]; + return id > 0 && id < VALUES.length ? VALUES[id] : VALUES[0]; } } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/UserInterfaceProfile.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/UserInterfaceProfile.java index b5000af92..c9cbf4b4e 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/UserInterfaceProfile.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/UserInterfaceProfile.java @@ -3,7 +3,8 @@ public enum UserInterfaceProfile { CLASSIC, - POCKET; + POCKET, + NONE; private static final UserInterfaceProfile[] VALUES = values();