Interface PackObfuscator

All Known Implementing Classes:
PackObfuscator.Order

public interface PackObfuscator
Defines a strategy for obfuscating resource names in the pack.

Obfuscation can help reduce file path lengths and protect asset names.

Since:
1.15.2
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    An obfuscator that generates short names based on the order of appearance.
    static final record 
    A pair of obfuscators for models and textures.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final PackObfuscator
    A no-op obfuscator that returns the name as-is.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull String
    obfuscate(@NotNull String rawName)
    Obfuscates the given raw name.
    static @NotNull PackObfuscator
    Creates an order-based obfuscator if obfuscation is enabled in the configuration.
    static @NotNull PackObfuscator.Pair
    pair(@NotNull PackObfuscator models, @NotNull PackObfuscator textures)
    Creates a pair obfuscator from two separate obfuscators.
    default @NotNull PackObfuscator.Pair
    withModels(@NotNull PackObfuscator models)
    Creates a pair obfuscator, combining this obfuscator (as textures) with another (as models).
  • Field Details

    • NONE

      static final PackObfuscator NONE
      A no-op obfuscator that returns the name as-is.
      Since:
      1.15.2
  • Method Details

    • obfuscate

      @NotNull @NotNull String obfuscate(@NotNull @NotNull String rawName)
      Obfuscates the given raw name.
      Parameters:
      rawName - the original name
      Returns:
      the obfuscated name
      Since:
      1.15.2
    • order

      @NotNull static @NotNull PackObfuscator order()
      Creates an order-based obfuscator if obfuscation is enabled in the configuration.
      Returns:
      the obfuscator
      Since:
      1.15.2
    • withModels

      @NotNull default @NotNull PackObfuscator.Pair withModels(@NotNull @NotNull PackObfuscator models)
      Creates a pair obfuscator, combining this obfuscator (as textures) with another (as models).
      Parameters:
      models - the models obfuscator
      Returns:
      the pair obfuscator
      Since:
      1.15.2
    • pair

      @NotNull static @NotNull PackObfuscator.Pair pair(@NotNull @NotNull PackObfuscator models, @NotNull @NotNull PackObfuscator textures)
      Creates a pair obfuscator from two separate obfuscators.
      Parameters:
      models - the models obfuscator
      textures - the textures obfuscator
      Returns:
      the pair obfuscator
      Since:
      1.15.2