Skip to content
Aki edited this page Aug 22, 2018 · 1 revision

The Enum itself must be annotated (just as classes and interfaces) with a @LClassfile annotation that states in which version it exists and whether it should get obfuscated.

Enum constants must be attached with a @LEnum annotation that allows for obfuscation.

Here's an example enum:

@LClassfile(version = { V1_11_R1, V1_12_R1 })
public enum EnumDifficulty {
    // This constant exists in both version
    @LEnum(version = { V1_11_R1, V1_12_R1 })
    PEACEFUL(0, "peaceful"),

    // This constant exists only in version 1.12
    @LEnum(version = V1_12_R1)
    EASY(1, "easy"),

    // This constant gets obfuscated to the name "a" in version 1.11
    @LEnum(version = V1_11_R1, name = "a")
    @LEnum(version = V1_12_R1)
    NORMAL(2, "normal"),
}