use of net.minecraft.text.LiteralText in project KiwiClient by TangyKiwi.
the class ClientPlayerEntityMixin method onChatMessage.
@Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
public void onChatMessage(String message, CallbackInfo callbackInfo) {
if (ignoreChatMessage)
return;
if (!message.startsWith(KiwiClient.PREFIX) && !message.startsWith("/")) {
SendChatMessageEvent event = new SendChatMessageEvent(message);
KiwiClient.eventBus.post(event);
if (!event.isCancelled()) {
ignoreChatMessage = true;
sendChatMessage(event.message);
ignoreChatMessage = false;
}
callbackInfo.cancel();
return;
}
if (message.startsWith(KiwiClient.PREFIX)) {
try {
KiwiClient.commandManager.dispatch(message.substring(KiwiClient.PREFIX.length()));
} catch (CommandSyntaxException e) {
Utils.mc.inGameHud.getChatHud().addMessage(new LiteralText(e.getMessage()));
}
callbackInfo.cancel();
}
}
use of net.minecraft.text.LiteralText in project CITResewn by SHsuperCM.
the class CITResewnConfigScreenFactory method create.
public static Screen create(Screen parent) {
CITResewnConfig currentConfig = CITResewnConfig.INSTANCE(), defaultConfig = new CITResewnConfig();
ConfigBuilder builder = ConfigBuilder.create().setParentScreen(parent).setTitle(new TranslatableText("config.citresewn.title")).setSavingRunnable(currentConfig::write);
ConfigCategory category = builder.getOrCreateCategory(new LiteralText(""));
ConfigEntryBuilder entryBuilder = builder.entryBuilder();
category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.enabled.title"), currentConfig.enabled).setTooltip(new TranslatableText("config.citresewn.enabled.tooltip")).setSaveConsumer(newConfig -> {
if (currentConfig.enabled != newConfig) {
currentConfig.enabled = newConfig;
MinecraftClient.getInstance().reloadResources();
}
}).setDefaultValue(defaultConfig.enabled).build());
category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.mute_errors.title"), currentConfig.mute_errors).setTooltip(new TranslatableText("config.citresewn.mute_errors.tooltip")).setSaveConsumer(newConfig -> currentConfig.mute_errors = newConfig).setDefaultValue(defaultConfig.mute_errors).build());
category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.mute_warns.title"), currentConfig.mute_warns).setTooltip(new TranslatableText("config.citresewn.mute_warns.tooltip")).setSaveConsumer(newConfig -> currentConfig.mute_warns = newConfig).setDefaultValue(defaultConfig.mute_warns).build());
category.addEntry(entryBuilder.startFloatField(new TranslatableText("config.citresewn.citenchantment_scroll_multiplier.title"), currentConfig.citenchantment_scroll_multiplier).setTooltip(new TranslatableText("config.citresewn.citenchantment_scroll_multiplier.tooltip")).setSaveConsumer(newConfig -> currentConfig.citenchantment_scroll_multiplier = newConfig).setDefaultValue(defaultConfig.citenchantment_scroll_multiplier).setMin(0f).build());
category.addEntry(entryBuilder.startIntSlider(new TranslatableText("config.citresewn.cache_ms.title"), currentConfig.cache_ms / 50, 0, 5 * 20).setTooltip(new TranslatableText("config.citresewn.cache_ms.tooltip")).setSaveConsumer(newConfig -> currentConfig.cache_ms = newConfig * 50).setDefaultValue(currentConfig.cache_ms / 50).setTextGetter(ticks -> {
if (ticks <= 1)
return new TranslatableText("config.citresewn.cache_ms.ticks." + ticks).formatted(Formatting.AQUA);
Formatting color = Formatting.DARK_RED;
if (ticks <= 40)
color = Formatting.RED;
if (ticks <= 20)
color = Formatting.GOLD;
if (ticks <= 10)
color = Formatting.DARK_GREEN;
if (ticks <= 5)
color = Formatting.GREEN;
return new TranslatableText("config.citresewn.cache_ms.ticks.any", ticks).formatted(color);
}).build());
category.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.citresewn.broken_paths.title"), currentConfig.broken_paths).setTooltip(new TranslatableText("config.citresewn.broken_paths.tooltip")).setSaveConsumer(newConfig -> currentConfig.broken_paths = newConfig).setDefaultValue(defaultConfig.broken_paths).requireRestart().build());
return builder.build();
}
use of net.minecraft.text.LiteralText in project BedrockIfy by juancarloscp52.
the class Overlay method renderPositionText.
private void renderPositionText(MatrixStack matrixStack) {
BedrockifySettings settings = Bedrockify.getInstance().settings;
int screenBorder = settings.getScreenSafeArea();
int posY = settings.getPositionHUDHeight();
if (!settings.isShowPositionHUDEnabled())
return;
BlockPos blockPos = Objects.requireNonNull(this.client.getCameraEntity(), "Camera Entity cannot be null.").getBlockPos();
MutableText position = new TranslatableText("bedrockify.hud.position").append(new LiteralText(" " + blockPos.getX() + ", " + blockPos.getY() + ", " + blockPos.getZ()));
if (settings.getFPSHUDoption() == 1)
position.append(" ").append(fps);
int positionWidth = client.textRenderer.getWidth(position);
fill(matrixStack, textPosX + screenBorder, posY + screenBorder, textPosX + positionWidth + 6 + screenBorder, posY + 10 + screenBorder, MathHelper.ceil((255.0D * client.options.textBackgroundOpacity)) << 24);
client.textRenderer.drawWithShadow(matrixStack, position, textPosX + 3 + screenBorder, posY + 1 + screenBorder, 16777215);
}
use of net.minecraft.text.LiteralText in project ImmersivePortalsMod by qouteall.
the class MyCommandClient method reportResourceConsumption.
private static int reportResourceConsumption(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
StringBuilder str = new StringBuilder();
str.append("Client Chunk:\n");
CGlobal.clientWorldLoader.clientWorldMap.values().forEach(world -> {
str.append(String.format("%s %s\n", world.dimension.getType(), ((MyClientChunkManager) world.getChunkManager()).getChunkNum()));
});
str.append("Chunk Renderers:\n");
CGlobal.clientWorldLoader.worldRendererMap.forEach((dimension, worldRenderer) -> {
str.append(String.format("%s %s\n", dimension, ((IEChunkRenderDispatcher) ((IEWorldRenderer) worldRenderer).getChunkRenderDispatcher()).getEmployedRendererNum()));
});
str.append("Server Chunks:\n");
McHelper.getServer().getWorlds().forEach(world -> {
str.append(String.format("%s %s\n", world.dimension.getType(), world.getForcedChunks().size()));
});
String result = str.toString();
Helper.log(str);
context.getSource().getPlayer().sendMessage(new LiteralText(result));
return 0;
}
use of net.minecraft.text.LiteralText in project pingspam by BasiqueEvangelist.
the class ServerPlayerEntityMixin method tick.
@Inject(method = "tick", at = @At("TAIL"))
private void tick(CallbackInfo ci) {
if (pings.size() > 0 && PingSpam.CONFIG.getConfig().showUnreadMessagesInActionbar) {
actionbarTime--;
if (actionbarTime <= 0) {
actionbarTime = ACTIONBAR_TIME;
networkHandler.sendPacket(new TitleS2CPacket(TitleS2CPacket.Action.ACTIONBAR, new LiteralText("You have " + pings.size() + " unread message" + (pings.size() != 1 ? "s" : "") + ".")));
}
} else {
actionbarTime = 0;
}
}
Aggregations