use of net.minecraft.text.TranslatableText in project Moonfix by Kingdom-of-Moon.
the class BooleanEntry method render.
@Override
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
// text
TextRenderer textRenderer = client.textRenderer;
int posY = y + entryHeight / 2;
textRenderer.draw(matrices, this.title, (float) x, (float) (posY - 9 / 2), 0xFFFFFF);
// reset button
this.reset.x = x + 260;
this.reset.y = y;
this.reset.active = this.config.configValue != this.config.defaultValue;
this.reset.render(matrices, mouseX, mouseY, tickDelta);
// toggle button
this.toggle.x = x + 175;
this.toggle.y = y;
this.toggle.setMessage(new TranslatableText("gui." + ((boolean) this.config.configValue ? "yes" : "no")));
// if setting is changed
if ((boolean) this.config.configValue != this.initValue)
this.toggle.setMessage(new LiteralText("").styled(ConfigManager.ACCENT_COLOR).append(this.toggle.getMessage()));
this.toggle.render(matrices, mouseX, mouseY, tickDelta);
}
use of net.minecraft.text.TranslatableText in project Architects-Palette-Fabric by Slomaxonical-907.
the class APPlugin method addInfo.
private DefaultInformationDisplay addInfo(Item item, String key) {
EntryStack entryStack = EntryStack.create(item);
DefaultInformationDisplay stackInfo = DefaultInformationDisplay.createFromEntry(entryStack, new TranslatableText(item.getTranslationKey()));
stackInfo.line(new TranslatableText("architects_palette.rei." + key));
return stackInfo;
}
use of net.minecraft.text.TranslatableText in project EarthMCEssentials by EarthMC-Stats.
the class NearbyCommand method register.
public static void register() {
ClientCommandManager.DISPATCHER.register(ClientCommandManager.literal("nearby").executes(c -> {
MinecraftClient client = MinecraftClient.getInstance();
if (client.player == null)
return -1;
Formatting headingFormatting = Formatting.byName(instance().getConfig().nearby.headingTextColour.name());
Formatting textFormatting = Formatting.byName(instance().getConfig().nearby.playerTextColour.name());
MsgUtils.sendPlayer("text_nearby_header", false, headingFormatting, false);
for (int i = 0; i < instance().getNearbyPlayers().size(); i++) {
JsonObject currentPlayer = instance().getNearbyPlayers().get(i).getAsJsonObject();
JsonElement xElement = currentPlayer.get("x");
JsonElement zElement = currentPlayer.get("z");
if (xElement == null || zElement == null)
continue;
int distance = Math.abs(xElement.getAsInt() - (int) client.player.getX()) + Math.abs(zElement.getAsInt() - (int) client.player.getZ());
String prefix = "";
if (instance().getConfig().nearby.showRank) {
if (!currentPlayer.has("town"))
prefix = new TranslatableText("text_nearby_rank_townless").toString();
else
prefix = "(" + currentPlayer.get("rank").getAsString() + ") ";
}
MsgUtils.sendPlayer(prefix + currentPlayer.get("name").getAsString() + ": " + distance + "m", false, textFormatting, false);
}
return 1;
}).then(ClientCommandManager.literal("refresh").executes(c -> {
instance().scheduler().stop();
instance().scheduler().start();
MsgUtils.sendPlayer("msg_nearby_refresh", false, Formatting.AQUA, true);
return 1;
})).then(ClientCommandManager.literal("clear").executes(c -> {
instance().setNearbyPlayers(new JsonArray());
MsgUtils.sendPlayer("msg_nearby_clear", false, Formatting.AQUA, true);
return 1;
})));
}
use of net.minecraft.text.TranslatableText in project Hypnotic-Client by Hypnotic-Development.
the class GetProtocolPacketListener method onResponse.
@Override
public void onResponse(QueryResponseS2CPacket packet) {
protocol = packet.getServerMetadata().getVersion().getProtocolVersion();
completed = true;
connection.disconnect(new TranslatableText("multiplayer.status.finished"));
}
use of net.minecraft.text.TranslatableText in project tweed-api by Siphalor.
the class TweedClothBridge method open.
public Screen open() {
inGame = MinecraftClient.getInstance().world != null;
parentScreen = MinecraftClient.getInstance().currentScreen;
if (inGame) {
boolean requiresSync = false;
for (ConfigFileEntry entry : configFiles) {
if (entry.configFile.getRootCategory().entryStream().anyMatch(configEntry -> configEntry.getValue().getEnvironment() != ConfigEnvironment.CLIENT)) {
requiresSync = true;
break;
}
}
if (!requiresSync) {
return buildScreen();
}
for (ConfigFileEntry entry : configFiles) {
PacketByteBuf buffer = new PacketByteBuf(Unpooled.buffer());
buffer.writeString(entry.configFile.getName());
buffer.writeEnumConstant(ConfigEnvironment.UNIVERSAL);
buffer.writeEnumConstant(ConfigScope.SMALLEST);
buffer.writeEnumConstant(ConfigOrigin.MAIN);
ClientSidePacketRegistry.INSTANCE.sendToServer(Tweed.REQUEST_SYNC_C2S_PACKET, buffer);
entry.awaitSync = true;
}
ClientCore.scheduledClothBridge = this;
return new NoticeScreen(() -> {
MinecraftClient.getInstance().openScreen(parentScreen);
ClientCore.scheduledClothBridge = null;
}, new TranslatableText("tweed.gui.screen.syncFromServer"), new TranslatableText("tweed.gui.screen.syncFromServer.note"));
} else {
return buildScreen();
}
}
Aggregations