use of net.minecraft.text.Text in project mineclub-expanded by Blobanium.
the class CommandParser method registerCommand.
public static void registerCommand() {
ClientCommandManager.DISPATCHER.register(ClientCommandManager.literal("mcex").executes(context -> {
context.getSource().sendFeedback(Text.Serializer.fromJson("[\"\",{\"text\":\"Mineclub Expanded\\n\"},{\"text\":\"Click here to see the full set of commands\",\"color\":\"light_purple\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://github.com/Blobanium/mineclub-expanded/wiki/List-Of-Commands\"}}]"));
return 0;
}));
ClientCommandManager.DISPATCHER.register(ClientCommandManager.literal("mcex").then(ClientCommandManager.literal("getminingvalue").executes(context -> {
context.getSource().sendFeedback(new LiteralText(GetMiningValue.miningValueResponseString(false)));
return 0;
})));
ClientCommandManager.DISPATCHER.register(ClientCommandManager.literal("mcex").then(ClientCommandManager.literal("getminingvalue").then(ClientCommandManager.literal("deatiled").executes(context -> {
context.getSource().sendFeedback(new LiteralText(GetMiningValue.miningValueResponseString(true)));
return 0;
}))));
ClientCommandManager.DISPATCHER.register(ClientCommandManager.literal("mcex").then(ClientCommandManager.literal("yourmom").executes(context -> {
context.getSource().sendFeedback(new LiteralText("No your mom."));
return 0;
})));
}
use of net.minecraft.text.Text in project quilt-standard-libraries by QuiltMC.
the class ClientCommandInternals method getErrorMessage.
/**
* Analogous to {@code CommandSuggestor#formatException}, but returns a {@link Text} rather than an
* {@link net.minecraft.text.OrderedText OrderedText}.
*
* @param e the exception to get the error message from
*
* @return the error message as a {@link Text}
*/
private static Text getErrorMessage(CommandSyntaxException e) {
Text message = Texts.toText(e.getRawMessage());
String context = e.getContext();
return context != null ? new TranslatableText("command.context.parse_error", message, context) : message;
}
use of net.minecraft.text.Text in project quilt-standard-libraries by QuiltMC.
the class NetworkingPlayPacketClientTest method receive.
private void receive(ClientPlayNetworkHandler handler, PacketSender sender, MinecraftClient client, PacketByteBuf buf) {
Text text = buf.readText();
client.execute(() -> client.inGameHud.setOverlayMessage(text, true));
}
use of net.minecraft.text.Text in project AutoResetMod by DuncanRuns.
the class OptionsScreenMixin method addStopRunButtonMixin.
@Inject(method = "init", at = @At("TAIL"))
private void addStopRunButtonMixin(CallbackInfo info) {
if (AutoReset.isPlaying) {
// Get menu.stop_resets text or set to default
Text text;
if (Language.getInstance().get("menu.stop_resets").equals("menu.stop_resets")) {
text = new LiteralText("Stop Resets & Quit");
} else {
text = new TranslatableText("menu.stop_resets");
}
// Add button to disable the auto reset and quit
this.addButton(new ButtonWidget(0, this.height - 20, 100, 20, text, (buttonWidget) -> {
AutoReset.isPlaying = false;
buttonWidget.active = false;
this.client.world.disconnect();
this.client.disconnect(new SaveLevelScreen(new TranslatableText("menu.savingLevel")));
this.client.openScreen(new TitleScreen());
}));
}
}
use of net.minecraft.text.Text in project dynmap by webbukkit.
the class FabricCommandSender method sendMessage.
@Override
public void sendMessage(String msg) {
if (sender != null) {
Text ichatcomponent = new LiteralText(msg);
sender.sendFeedback(ichatcomponent, false);
}
}
Aggregations