Interface IAdaptiveLocalizerAPI
public interface IAdaptiveLocalizerAPI
A text localizer that adapts to the player that the text is to be read by, whether the player has the mod installed or not.
-
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.network.chat.MutableComponent
Gets a text component for translatable text adapted to a specified player.net.minecraft.network.chat.Component
getFor
(net.minecraft.server.level.ServerPlayer player, net.minecraft.network.chat.Component component) Converts a text component to be readable by a specified player, if necessary.
-
Method Details
-
getFor
@Nonnull net.minecraft.network.chat.MutableComponent getFor(@Nonnull net.minecraft.server.level.ServerPlayer player, @Nonnull String key, @Nonnull Object... args) Gets a text component for translatable text adapted to a specified player.- Parameters:
player
- the player to read the text component, not nullkey
- the key of the translated line, not nullargs
- the arguments to format the translated line with, optional- Returns:
- the text component, not null
-
getFor
@Nonnull net.minecraft.network.chat.Component getFor(@Nonnull net.minecraft.server.level.ServerPlayer player, @Nonnull net.minecraft.network.chat.Component component) Converts a text component to be readable by a specified player, if necessary.Only ever converts translatable text components and always returns anything else unchanged. The arguments of a translatable text component are also converted if necessary. Does not convert the siblings of the text component.
- Parameters:
player
- the player to read the text component, not nullcomponent
- the text component to adapt to the player, not null- Returns:
- the converted text component or the unchanged input component if no conversion was necessary, not null
-