Interface ProfileTransformer

All Known Implementing Classes:
ProfileTransformer.IncludeOriginalValue, ProfileTransformer.MakeNotStackable, ProfileTransformer.RemoveMetadata

public interface ProfileTransformer
Modifies a GameProfile by a set of defined operations. Transformers can be composed and should be applied in order.
See Also:
  • Method Details

    • transform

      @NotNull @NotNull com.mojang.authlib.GameProfile transform(@NotNull @NotNull Profileable profileable, @NotNull @NotNull com.mojang.authlib.GameProfile profile)
      Transforms the given profile by the defined operations. The operations are applied on the same instance of the profile.
      Parameters:
      profileable - the profileable which the first profile originated from.
      profile - the profile to apply the operations on.
      Returns:
      may return the same or a new instance.
    • canBeCached

      @Internal boolean canBeCached()
      Whether the results of this transformation can be cached or not.
    • stackable

      @NotNull static @NotNull ProfileTransformer stackable()
      By default, due to internal changes to the GameProfile, (specially the Base64-encoded textures property) the items are considered "different" (for example ItemStack.isSimilar(ItemStack) would return false) which means they cannot be stacked together in the game.

      These changes can include:

      • Mojang's cache/API might add/remove properties from the profile.
      • Mojang's API adds a timestamp property that shows when was the last time the profile was updated. This can be frequent or take up to hours to change.
      • Mojang's cache/API might change the order or format of the textures JSON.
      • Players that change a portion of their skin (other than the head) will still be visually the same, but their texture URL will be changed.
      • Profiles created/modified by XSeries have a special signature added.
      • A skull with includeOriginalValue() with another one that doesn't have this transformation.

      This transformer, makes the items stackable (x64 stack) This currently has no observable effect on blocks. Technically the same as removeMetadata() but it's here for future compatibility purposes.
      See Also:
    • nonStackable

      @NotNull static @NotNull ProfileTransformer nonStackable()
      Makes the items non-stackable (x64 stack) Read stackable() for more info. This adds additional properties other than the ones mentioned in the other method that ensures items can never be stacked no matter how similar they are.
      See Also:
    • removeMetadata

      @NotNull static @NotNull ProfileTransformer removeMetadata()
      Removes extra properties from this profile. This includes the XSeries signature and the timestamp of the profile. Both which have no effect when removed, but the XSeries signature could be useful in debugging. It also removes includeOriginalValue() data if specified.
      See Also:
    • includeOriginalValue

      @NotNull static @NotNull ProfileTransformer includeOriginalValue()
      Whether a special property should be added to the profile where the original value (Profileable.getProfileValue()) was used to create the profile. This can later be used to affect Profileable.getProfileValue() which provides less verbose and compact data instead of the regular base64.

      This transformation is not applied by default and also, stackable() or removeMetadata() removes this data.