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 TypeMethodDescriptionstatic @NotNull ComponentMessageThrowable
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@NotNull ComponentFlattener
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 insteadstatic @NotNull Identity
identity
(@NotNull com.mojang.authlib.GameProfile profile) Get anIdentity
representation of aGameProfile
.static @NotNull ComponentSerializer<Component,
Component, net.minecraft.network.chat.Component> Return a TextSerializer instance that will do deep conversions between AdventureComponents
and MinecraftComponents
.@NotNull ComponentRenderer<Pointered>
renderer()
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.UseComponentLike.asComponent()
instead, implemented onComponent
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
Get a nativeComponent
from an adventureComponent
.static net.minecraft.resources.ResourceLocation
Convert a KyoriKey
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 componentmodifier
- 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.0Convert a MCResourceLocation
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 KyoriKey
instance to a MC ResourceLocation.All
Key
instances created in a Fabric environment with this mod are implemented byResourceLocation
, 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 insteadGet anEntity
's representation as anSound.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, nonWrappingSerializer()net.minecraft.network.chat.Component> Return a TextSerializer instance that will do deep conversions between AdventureComponents
and MinecraftComponents
.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 insteadGet aPlayer
identified by their profile'sUUID
.- 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 anIdentity
representation of aGameProfile
.- Parameters:
profile
- the profile to represent- Returns:
- an identity of the game profile
- Since:
- 4.0.0
-
flattener
Return a component flattener that can use game data to resolve extra information about components.- Returns:
- the flattener
- Since:
- 4.0.0
-
renderer
Active renderer to render components.- Returns:
- Shared renderer
- Since:
- 4.0.0
-
toNative
Get a nativeComponent
from an adventureComponent
.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.UseComponentLike.asComponent()
instead, implemented onComponent
Get an adventureComponent
from a nativeComponent
.- Parameters:
vanilla
- the native component- Returns:
- adventure component
- Since:
- 4.0.0
-