Interface FabricAudiences

All Known Subinterfaces:
FabricClientAudiences, FabricServerAudiences

public interface FabricAudiences
Common operations in both the client and server environments.

See FabricServerAudiences for logical server-specific operations, and FabricClientAudiences for logical client-specific operations

Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    asComponentThrowable(@NotNull com.mojang.brigadier.exceptions.CommandSyntaxException ex)
    Expose a Brigadier CommandSyntaxException's message using the adventure-provided interface for rich-message exceptions.
    static @NotNull Sound.Emitter
    asEmitter(@NotNull net.minecraft.world.entity.Entity entity)
    Deprecated, for removal: This API element is subject to removal in a future version.
    for removal, we can use loom interface injection instead
    Return a component flattener that can use game data to resolve extra information about components.
    static @NotNull Identified
    identified(@NotNull net.minecraft.world.entity.player.Player player)
    Deprecated, for removal: This API element is subject to removal in a future version.
    for removal, use interface injection instead
    static @NotNull Identity
    identity(@NotNull com.mojang.authlib.GameProfile profile)
    Get an Identity representation of a GameProfile.
    static @NotNull ComponentSerializer<Component,Component,net.minecraft.network.chat.Component>
    Return a TextSerializer instance that will do deep conversions between Adventure Components and Minecraft Components.
    Active renderer to render components.
    default @NotNull Component
    toAdventure(@NotNull net.minecraft.network.chat.Component vanilla)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use ComponentLike.asComponent() instead, implemented on Component
    static Key
    toAdventure(net.minecraft.resources.ResourceLocation loc)
    Deprecated, for removal: This API element is subject to removal in a future version.
    ResourceLocation directly implements key, and all Keys are ResourceLocations since Loader 0.14.0
    @NotNull net.minecraft.network.chat.Component
    toNative(@NotNull Component adventure)
    Get a native Component from an adventure Component.
    static net.minecraft.resources.ResourceLocation
    Convert a Kyori Key instance to a MC ResourceLocation.
    static @NotNull net.minecraft.network.chat.Component
    update(@NotNull net.minecraft.network.chat.Component input, UnaryOperator<Component> modifier)
    Given an existing native component, convert it into an Adventure component for working with.
  • Method Details

    • update

      static @NotNull net.minecraft.network.chat.Component update(@NotNull net.minecraft.network.chat.Component input, UnaryOperator<Component> modifier)
      Given an existing native component, convert it into an Adventure component for working with.
      Parameters:
      input - source component
      modifier - operator to transform the component
      Returns:
      new component
      Since:
      4.0.0
    • toAdventure

      @Deprecated(forRemoval=true, since="5.3.0") @Contract("null -> null; !null -> !null") static Key toAdventure(net.minecraft.resources.ResourceLocation loc)
      Deprecated, for removal: This API element is subject to removal in a future version.
      ResourceLocation directly implements key, and all Keys are ResourceLocations since Loader 0.14.0
      Convert a MC ResourceLocation instance to a text Key.
      Parameters:
      loc - The Identifier to convert
      Returns:
      The equivalent data as a Key
      Since:
      4.0.0
    • toNative

      @Contract("null -> null; !null -> !null") static net.minecraft.resources.ResourceLocation toNative(Key key)
      Convert a Kyori Key instance to a MC ResourceLocation.

      All Key instances created in a Fabric environment with this mod are implemented by ResourceLocation, as long as loader 0.14 is present, so this is effectively a cast.

      Parameters:
      key - The Key to convert
      Returns:
      The equivalent data as an Identifier
      Since:
      4.0.0
    • asEmitter

      @Deprecated(forRemoval=true, since="5.3.0") static @NotNull Sound.Emitter asEmitter(@NotNull @NotNull net.minecraft.world.entity.Entity entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      for removal, we can use loom interface injection instead
      Get an Entity's representation as an Sound.Emitter of sounds.
      Parameters:
      entity - the entity to convert
      Returns:
      the entity as a sound emitter
      Since:
      4.0.0
    • asComponentThrowable

      @NotNull static @NotNull ComponentMessageThrowable asComponentThrowable(@NotNull @NotNull com.mojang.brigadier.exceptions.CommandSyntaxException ex)
      Expose a Brigadier CommandSyntaxException's message using the adventure-provided interface for rich-message exceptions.
      Parameters:
      ex - the exception to cast
      Returns:
      a converted command exception
      Since:
      5.3.0
    • nonWrappingSerializer

      @NotNull static @NotNull ComponentSerializer<Component,Component,net.minecraft.network.chat.Component> nonWrappingSerializer()
      Return a TextSerializer instance that will do deep conversions between Adventure Components and Minecraft Components.

      This serializer will never wrap text, and can provide MutableComponent instances suitable for passing around the game.

      Returns:
      a serializer instance
      Since:
      4.0.0
    • identified

      @Deprecated(forRemoval=true, since="5.3.0") @NotNull static @NotNull Identified identified(@NotNull @NotNull net.minecraft.world.entity.player.Player player)
      Deprecated, for removal: This API element is subject to removal in a future version.
      for removal, use interface injection instead
      Get a Player identified by their profile's UUID.
      Parameters:
      player - the player to identify
      Returns:
      an identified representation of the player
      Since:
      4.0.0
    • identity

      @NotNull static @NotNull Identity identity(@NotNull @NotNull com.mojang.authlib.GameProfile profile)
      Get an Identity representation of a GameProfile.
      Parameters:
      profile - the profile to represent
      Returns:
      an identity of the game profile
      Since:
      4.0.0
    • flattener

      @NotNull @NotNull ComponentFlattener flattener()
      Return a component flattener that can use game data to resolve extra information about components.
      Returns:
      the flattener
      Since:
      4.0.0
    • renderer

      @NotNull @NotNull ComponentRenderer<Pointered> renderer()
      Active renderer to render components.
      Returns:
      Shared renderer
      Since:
      4.0.0
    • toNative

      @NotNull net.minecraft.network.chat.Component toNative(@NotNull @NotNull Component adventure)
      Get a native Component from an adventure Component.

      The specific type of the returned component is undefined. For example, it may be a wrapper object.

      Parameters:
      adventure - adventure input
      Returns:
      native representation
      Since:
      4.0.0
    • toAdventure

      @Deprecated(forRemoval=true) @NotNull default @NotNull Component toAdventure(@NotNull net.minecraft.network.chat.Component vanilla)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use ComponentLike.asComponent() instead, implemented on Component
      Get an adventure Component from a native Component.
      Parameters:
      vanilla - the native component
      Returns:
      adventure component
      Since:
      4.0.0