From f2491afa22926f067ceb1b8b2968895f4839593b Mon Sep 17 00:00:00 2001 From: Niek Vincent Date: Tue, 24 Oct 2023 12:47:52 +0200 Subject: [PATCH] Add identifier to enum methods --- .../org/cloudburstmc/protocol/bedrock/data/InputMode.java | 8 +++++++- .../protocol/bedrock/data/skin/AnimatedTextureType.java | 8 +++++++- .../bedrock/data/skin/AnimationExpressionType.java | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/InputMode.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/InputMode.java index 0b8dd8531..a3d6cebc8 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/InputMode.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/InputMode.java @@ -5,5 +5,11 @@ public enum InputMode { MOUSE, TOUCH, GAMEPAD, - MOTION_CONTROLLER + MOTION_CONTROLLER; + + private static final InputMode[] VALUES = values(); + + public static InputMode from(int id) { + return VALUES[id]; + } } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/skin/AnimatedTextureType.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/skin/AnimatedTextureType.java index cccab4158..0c081fc9c 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/skin/AnimatedTextureType.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/skin/AnimatedTextureType.java @@ -4,5 +4,11 @@ public enum AnimatedTextureType { NONE, FACE, BODY_32X32, - BODY_128X128 + BODY_128X128; + + private static final AnimatedTextureType[] VALUES = values(); + + public static AnimatedTextureType from(int id) { + return VALUES[id]; + } } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/skin/AnimationExpressionType.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/skin/AnimationExpressionType.java index 69a689f5c..20bb98d78 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/skin/AnimationExpressionType.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/skin/AnimationExpressionType.java @@ -2,5 +2,11 @@ public enum AnimationExpressionType { LINEAR, - BLINKING + BLINKING; + + private static final AnimationExpressionType[] VALUES = values(); + + public static AnimationExpressionType from(int id) { + return VALUES[id]; + } }