net.minecraft.client.resource.language.I18n Java Examples
The following examples show how to use
net.minecraft.client.resource.language.I18n.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HallowedLoadingScreen.java From the-hallow with MIT License | 6 votes |
@Override public void render(int mouseX, int mouseY, float delta) { renderDirtBackground(0); this.drawCenteredString(font, I18n.translate(message), width / 2, height / 2 - 50, 0xFFFFFF); float scale = 100f; RenderSystem.pushMatrix(); RenderSystem.translatef(width / 2f, height / 2f + 65 + MathHelper.sin(floatingTick / 6.5f) * 25, 500f); RenderSystem.scalef(scale, scale, scale); RenderSystem.rotatef(180, 1, 0, 0); RenderSystem.rotatef(rotation, 0, 1, 0); minecraft.getTextureManager().bindTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEX); minecraft.getItemRenderer().renderGuiItem(pumpkinStack, 0, 0); RenderSystem.popMatrix(); }
Example #2
Source File: TitleScreenMixin.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Inject(at = {@At("RETURN")}, method = {"initWidgetsNormal(II)V"}) private void onInitWidgetsNormal(int y, int spacingY, CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled()) return; addButton(new ButtonWidget(width / 2 + 2, y + spacingY * 2, 98, 20, new LiteralText("Alt Manager"), b -> client.openScreen(new AltManagerScreen(this, WurstClient.INSTANCE.getAltManager())))); for(AbstractButtonWidget button : buttons) { if(!button.getMessage().getString() .equals(I18n.translate("menu.online"))) continue; button.setWidth(98); } }
Example #3
Source File: StatsScreenMixin.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
@Inject(at = {@At("TAIL")}, method = {"createButtons()V"}) private void onCreateButtons(CallbackInfo ci) { ButtonWidget toggleWurstButton = new ButtonWidget(width / 2 - 152, height - 28, 150, 20, new LiteralText(""), this::toggleWurst); updateWurstButtonText(toggleWurstButton); addButton(toggleWurstButton); for(AbstractButtonWidget button : buttons) { if(!button.getMessage().getString() .equals(I18n.translate("gui.done"))) continue; button.x = width / 2 + 2; button.setWidth(150); } }
Example #4
Source File: GuiPonySettings.java From MineLittlePony with MIT License | 6 votes |
public String describeCurrentScale(float value) { if (value >= 3) { return "minelp.debug.scale.meg"; } if (value == 2) { return "minelp.debug.scale.max"; } if (value == 1) { return "minelp.debug.scale.mid"; } if (value == 0.9F) { return "minelp.debug.scale.sa"; } if (value <= 0.1F) { return "minelp.debug.scale.min"; } value *= 100F; value = Math.round(value); value /= 100F; return I18n.translate("minelp.debug.scale.value", value); }
Example #5
Source File: GameMenuScreenMixin.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private boolean isFeedbackOrBugReportButton(Element element) { if(element == null || !(element instanceof AbstractButtonWidget)) return false; AbstractButtonWidget button = (AbstractButtonWidget)element; String message = button.getMessage().getString(); return message != null && (message.equals(I18n.translate("menu.sendFeedback")) || message.equals(I18n.translate("menu.reportBugs"))); }
Example #6
Source File: SandboxTitleScreen.java From Sandbox with GNU Lesser General Public License v3.0 | 5 votes |
protected void init() { if (this.splashText == null) { this.splashText = this.minecraft.getSplashTextLoader().get(); } this.copyrightTextWidth = this.font.getStringWidth("Copyright Mojang AB. Do not distribute!"); this.copyrightTextX = this.width - this.copyrightTextWidth - 2; int int_2 = this.height / 4 + 48; if (this.minecraft.isDemo()) { this.initWidgetsDemo(int_2, 24); } else { this.initWidgetsNormal(int_2, 24); } this.addButton(new TexturedButtonWidget(this.width / 2 - 124, int_2 + 72 + 12, 20, 20, 0, 106, 20, ButtonWidget.WIDGETS_LOCATION, 256, 256, (buttonWidget_1) -> { this.minecraft.openScreen(new LanguageOptionsScreen(this, this.minecraft.options, this.minecraft.getLanguageManager())); }, I18n.translate("narrator.button.language"))); this.addButton(new ButtonWidget(this.width / 2 - 100, int_2 + 72 + 12, 98, 20, I18n.translate("menu.options"), (buttonWidget_1) -> { this.minecraft.openScreen(new SettingsScreen(this, this.minecraft.options)); })); this.addButton(new ButtonWidget(this.width / 2 + 2, int_2 + 72 + 12, 98, 20, I18n.translate("menu.quit"), (buttonWidget_1) -> { this.minecraft.scheduleStop(); })); this.addButton(new TexturedButtonWidget(this.width / 2 + 104, int_2 + 72 + 12, 20, 20, 0, 0, 20, ACCESSIBILITY_ICON_TEXTURE, 32, 64, (buttonWidget_1) -> { this.minecraft.openScreen(new AccessibilityScreen(this, this.minecraft.options)); }, I18n.translate("narrator.button.accessibility"))); if (this.warning != null) { this.warning.init(int_2); } }
Example #7
Source File: SandboxTitleScreen.java From Sandbox with GNU Lesser General Public License v3.0 | 5 votes |
private void initWidgetsNormal(int int_1, int int_2) { this.addButton(new ButtonWidget(this.width / 2 - 100, int_1, 200, 20, I18n.translate("menu.singleplayer"), (buttonWidget_1) -> { this.minecraft.openScreen(new SelectWorldScreen(this)); })); this.addButton(new ButtonWidget(this.width / 2 - 100, int_1 + int_2, 200, 20, I18n.translate("menu.multiplayer"), (buttonWidget_1) -> { this.minecraft.openScreen(new MultiplayerScreen(this)); })); }
Example #8
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) { glSetup(x, y, z); GL11.glScaled(0.4*scale, 0.4*scale, 0); GL11.glTranslated(offX, offY, 0); if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F); mc.getItemRenderer().renderItem(new ItemStack(item.getItem()), Type.GUI); if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glScalef(-0.05F, -0.05F, 0); if (item.getCount() > 0) { int w = mc.textRenderer.getStringWidth("x" + item.getCount()) / 2; mc.textRenderer.drawWithShadow("x" + item.getCount(), 7 - w, 5, 0xffffff); } GL11.glScalef(0.85F, 0.85F, 0.85F); int c = 0; for (Entry<Enchantment, Integer> m: EnchantmentHelper.getEnchantments(item).entrySet()) { int w1 = mc.textRenderer.getStringWidth(I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue()) / 2; mc.textRenderer.drawWithShadow( I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue(), -4 - w1, c*10-1, m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE ? 0xff5050 : 0xffb0e0); c--; } GL11.glScalef(0.6F, 0.6F, 0.6F); String dur = item.getMaxDamage() - item.getDamage() + ""; int color = 0x000000; try{ color = MathHelper.hsvToRgb(((float) (item.getMaxDamage() - item.getDamage()) / item.getMaxDamage()) / 3.0F, 1.0F, 1.0F); } catch (Exception e) {} if (item.isDamageable()) mc.textRenderer.drawWithShadow(dur, -8 - dur.length() * 3, 15, new Color(color >> 16 & 255, color >> 8 & 255, color & 255).getRGB()); glCleanup(); }
Example #9
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) { glSetup(x, y, z); GL11.glScaled(0.4*scale, 0.4*scale, 0); GL11.glTranslated(offX, offY, 0); if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F); mc.getItemRenderer().renderItem(new ItemStack( item.getItem()), Mode.GUI, 0, 0, new MatrixStack(), mc.getBufferBuilders().getEntityVertexConsumers()); if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glScalef(-0.05F, -0.05F, 0); if (item.getCount() > 0) { int w = mc.textRenderer.getWidth("x" + item.getCount()) / 2; mc.textRenderer.drawWithShadow(new MatrixStack(), "x" + item.getCount(), 7 - w, 5, 0xffffff); } GL11.glScalef(0.85F, 0.85F, 0.85F); int c = 0; for (Entry<Enchantment, Integer> m: EnchantmentHelper.get(item).entrySet()) { int w1 = mc.textRenderer.getWidth(I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue()) / 2; mc.textRenderer.drawWithShadow(new MatrixStack(), I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue(), -4 - w1, c*10-1, m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE ? 0xff5050 : 0xffb0e0); c--; } GL11.glScalef(0.6F, 0.6F, 0.6F); String dur = item.getMaxDamage() - item.getDamage() + ""; int color = 0x000000; try{ color = MathHelper.hsvToRgb(((float) (item.getMaxDamage() - item.getDamage()) / item.getMaxDamage()) / 3.0F, 1.0F, 1.0F); } catch (Exception e) {} if (item.isDamageable()) mc.textRenderer.drawWithShadow(new MatrixStack(), dur, -8 - dur.length() * 3, 15, new Color(color >> 16 & 255, color >> 8 & 255, color & 255).getRGB()); glCleanup(); }
Example #10
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) { glSetup(x, y, z); GL11.glScaled(0.4*scale, 0.4*scale, 0); GL11.glTranslated(offX, offY, 0); if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F); mc.getItemRenderer().renderItem(new ItemStack( item.getItem()), Mode.GUI, 0, 0, new MatrixStack(), mc.getBufferBuilders().getEntityVertexConsumers()); if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glScalef(-0.05F, -0.05F, 0); if (item.getCount() > 0) { int w = mc.textRenderer.getStringWidth("x" + item.getCount()) / 2; mc.textRenderer.drawWithShadow("x" + item.getCount(), 7 - w, 5, 0xffffff); } GL11.glScalef(0.85F, 0.85F, 0.85F); int c = 0; for (Entry<Enchantment, Integer> m: EnchantmentHelper.getEnchantments(item).entrySet()) { int w1 = mc.textRenderer.getStringWidth(I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue()) / 2; mc.textRenderer.drawWithShadow( I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue(), -4 - w1, c*10-1, m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE ? 0xff5050 : 0xffb0e0); c--; } GL11.glScalef(0.6F, 0.6F, 0.6F); String dur = item.getMaxDamage() - item.getDamage() + ""; int color = 0x000000; try{ color = MathHelper.hsvToRgb(((float) (item.getMaxDamage() - item.getDamage()) / item.getMaxDamage()) / 3.0F, 1.0F, 1.0F); } catch (Exception e) {} if (item.isDamageable()) mc.textRenderer.drawWithShadow(dur, -8 - dur.length() * 3, 15, new Color(color >> 16 & 255, color >> 8 & 255, color & 255).getRGB()); glCleanup(); }
Example #11
Source File: MachineHandledScreen.java From Galacticraft-Rewoven with MIT License | 4 votes |
public void drawConfigTabs(MatrixStack stack) { if (this.handler.blockEntity != null) { ConfigurableElectricMachineBlockEntity entity = this.handler.blockEntity; ConfigurableElectricMachineBlockEntity.SecurityInfo security = entity.getSecurity(); if (IS_REDSTONE_OPEN) { this.client.getTextureManager().bindTexture(PANELS_TEXTURE); this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH, this.y + 3, REDSTONE_PANEL_X, REDSTONE_PANEL_Y, REDSTONE_PANEL_WIDTH, REDSTONE_PANEL_HEIGHT); this.client.getItemRenderer().renderInGuiWithOverrides(new ItemStack(Items.REDSTONE), this.x - REDSTONE_PANEL_WIDTH + 6, this.y + 7); this.drawStringWithShadow(stack, this.client.textRenderer, I18n.translate("ui.galacticraft-rewoven.tabs.redstone_activation_config"), this.x - REDSTONE_PANEL_WIDTH + 23, this.y + 12, Formatting.GRAY.getColorValue()); this.client.getTextureManager().bindTexture(PANELS_TEXTURE); this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 21, this.y + 26, BUTTON_OFF_X, BUTTON_OFF_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 43, this.y + 26, BUTTON_OFF_X, BUTTON_OFF_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 65, this.y + 26, BUTTON_OFF_X, BUTTON_OFF_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); switch (entity.getRedstoneState()) { case DISABLED: this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 21, this.y + 26, BUTTON_ON_X, BUTTON_ON_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); break; case OFF: this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 43, this.y + 26, BUTTON_ON_X, BUTTON_ON_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); break; case ON: this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 65, this.y + 26, BUTTON_ON_X, BUTTON_ON_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); break; } this.client.getItemRenderer().renderInGuiWithOverrides(new ItemStack(Items.GUNPOWDER), this.x - REDSTONE_PANEL_WIDTH + 21, this.y + 26); this.client.getTextureManager().bindTexture(PANELS_TEXTURE); this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 43, this.y + 23, REDSTONE_TORCH_OFF_X, REDSTONE_TORCH_OFF_Y, ICONS_WIDTH, ICONS_HEIGHT); this.client.getItemRenderer().renderInGuiWithOverrides(new ItemStack(Items.REDSTONE_TORCH), this.x - REDSTONE_PANEL_WIDTH + 65, this.y + 25 - 2); } else { this.client.getTextureManager().bindTexture(TABS_TEXTURE); this.drawTexture(stack, this.x - REDSTONE_TAB_WIDTH, this.y + 3, REDSTONE_TAB_X, REDSTONE_TAB_Y, REDSTONE_TAB_WIDTH, REDSTONE_TAB_HEIGHT); this.client.getItemRenderer().renderInGuiWithOverrides(new ItemStack(Items.REDSTONE), this.x - REDSTONE_TAB_WIDTH + 4, this.y + 6); } if (IS_CONFIG_OPEN) { this.client.getTextureManager().bindTexture(PANELS_TEXTURE); this.drawTexture(stack, this.x - CONFIG_PANEL_WIDTH, this.y + 26, CONFIG_PANEL_X, CONFIG_PANEL_Y, CONFIG_PANEL_WIDTH, CONFIG_PANEL_HEIGHT); //Front, Back, Right, Left, top, bottom this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 43 - 3 - 5, this.y + 49 + 3, getXForOption(sideOptions.get(BlockFace.TOP)), getYForOption(sideOptions.get(BlockFace.TOP)), BUTTONS_WIDTH, BUTTONS_HEIGHT); //TOP - Top this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 21 - 5, this.y + 49 + 22 - 11 + 7 + 3, getXForOption(sideOptions.get(BlockFace.RIGHT)), getYForOption(sideOptions.get(BlockFace.RIGHT)), BUTTONS_WIDTH, BUTTONS_HEIGHT); //MIDDLE LEFT - right this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 43 - 3 - 5, this.y + 49 + 22 - 11 + 7 + 3, getXForOption(sideOptions.get(BlockFace.FRONT)), getYForOption(sideOptions.get(BlockFace.FRONT)), BUTTONS_WIDTH, BUTTONS_HEIGHT); //MIDDLE LEFT-CENTER - Front this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 65 - 6 - 5, this.y + 49 + 22 - 11 + 7 + 3, getXForOption(sideOptions.get(BlockFace.LEFT)), getYForOption(sideOptions.get(BlockFace.LEFT)), BUTTONS_WIDTH, BUTTONS_HEIGHT); //MIDDLE RIGHT-CENTER - left this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 87 - 9 - 5, this.y + 49 + 22 - 11 + 7 + 3, getXForOption(sideOptions.get(BlockFace.BACK)), getYForOption(sideOptions.get(BlockFace.BACK)), BUTTONS_WIDTH, BUTTONS_HEIGHT); //RIGHT - Back this.drawTexture(stack, this.x - REDSTONE_PANEL_WIDTH + 43 - 3 - 5, this.y + 49 + 36 + 3, getXForOption(sideOptions.get(BlockFace.BOTTOM)), getYForOption(sideOptions.get(BlockFace.BOTTOM)), BUTTONS_WIDTH, BUTTONS_HEIGHT); //BOTTOM - BOTTOM this.client.getItemRenderer().renderInGuiWithOverrides(new ItemStack(GalacticraftItems.STANDARD_WRENCH), this.x - REDSTONE_PANEL_WIDTH + 6, this.y + 29); this.drawStringWithShadow(stack, this.client.textRenderer, I18n.translate("ui.galacticraft-rewoven.tabs.side_config"), this.x - REDSTONE_PANEL_WIDTH + 23, this.y + 33, Formatting.GRAY.getColorValue()); } else { this.client.getTextureManager().bindTexture(TABS_TEXTURE); if (!IS_REDSTONE_OPEN) { this.drawTexture(stack, this.x - CONFIG_TAB_WIDTH, this.y + 26, CONFIG_TAB_X, CONFIG_TAB_Y, CONFIG_TAB_WIDTH, CONFIG_TAB_HEIGHT); this.client.getItemRenderer().renderInGuiWithOverrides(new ItemStack(GalacticraftItems.STANDARD_WRENCH), this.x - CONFIG_TAB_WIDTH + 4, this.y + 26 + 3); } else { this.drawTexture(stack, this.x - CONFIG_TAB_WIDTH, this.y + 96, CONFIG_TAB_X, CONFIG_TAB_Y, CONFIG_TAB_WIDTH, CONFIG_TAB_HEIGHT); this.client.getItemRenderer().renderInGuiWithOverrides(new ItemStack(GalacticraftItems.STANDARD_WRENCH), this.x - CONFIG_TAB_WIDTH + 4, this.y + 96 + 3); } } if (IS_SECURITY_OPEN) { this.client.getTextureManager().bindTexture(PANELS_TEXTURE); this.drawTexture(stack, this.x + 176, this.y + 3, SECURITY_PANEL_X, SECURITY_PANEL_Y, SECURITY_PANEL_WIDTH, SECURITY_PANEL_HEIGHT); this.drawTexture(stack, this.x + 176 + 4, this.y + 6, LOCK_PARTY_X, LOCK_PARTY_Y + 2, ICONS_WIDTH, ICONS_HEIGHT); this.drawStringWithShadow(stack, this.client.textRenderer, I18n.translate("ui.galacticraft-rewoven.tabs.security_config"), this.x + 176 + 20, this.y + 12, Formatting.GRAY.getColorValue()); this.client.getTextureManager().bindTexture(PANELS_TEXTURE); this.drawTexture(stack, this.x + 174 + 21, this.y + 26, BUTTON_OFF_X, BUTTON_OFF_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); this.drawTexture(stack, this.x + 174 + 43, this.y + 26, BUTTON_OFF_X, BUTTON_OFF_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); this.drawTexture(stack, this.x + 174 + 65, this.y + 26, BUTTON_OFF_X, BUTTON_OFF_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); switch (security.getPublicity()) { case PRIVATE: this.drawTexture(stack, this.x + 174 + 21, this.y + 26, BUTTON_ON_X, BUTTON_ON_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); break; case SPACE_RACE: this.drawTexture(stack, this.x + 174 + 43, this.y + 26, BUTTON_ON_X, BUTTON_ON_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); break; case PUBLIC: this.drawTexture(stack, this.x + 174 + 65, this.y + 26, BUTTON_ON_X, BUTTON_ON_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); break; } this.drawTexture(stack, this.x + 174 + 21, this.y + 27, LOCK_OWNER_X, LOCK_OWNER_Y + 2, BUTTONS_WIDTH, BUTTONS_HEIGHT); this.drawTexture(stack, this.x + 174 + 43, this.y + 27, LOCK_PARTY_X, LOCK_PARTY_Y + 2, BUTTONS_WIDTH, BUTTONS_HEIGHT); this.drawTexture(stack, this.x + 174 + 65, this.y + 27 - 2, LOCK_PUBLIC_X, LOCK_PUBLIC_Y, BUTTONS_WIDTH, BUTTONS_HEIGHT); } else { this.client.getTextureManager().bindTexture(TABS_TEXTURE); this.drawTexture(stack, this.x + 176, this.y + 5, SECURITY_TAB_X, SECURITY_TAB_Y, SECURITY_TAB_WIDTH, SECURITY_TAB_HEIGHT); } } }
Example #12
Source File: DefaultCompressingCategory.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Environment(EnvType.CLIENT) public String getCategoryName() { return I18n.translate("category.rei.compressing"); }
Example #13
Source File: DefaultFabricationCategory.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Environment(EnvType.CLIENT) public String getCategoryName() { return I18n.translate("category.rei.circuit_fabricator"); }