本文整理匯總了Java中net.minecraft.client.resources.I18n類的典型用法代碼示例。如果您正苦於以下問題:Java I18n類的具體用法?Java I18n怎麽用?Java I18n使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
I18n類屬於net.minecraft.client.resources包,在下文中一共展示了I18n類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawItemTooltip
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
private void drawItemTooltip(int x, int y, ItemStack stack, boolean warn)
{
if (stack == null)
{
return;
}
List<String> lines = new ArrayList<>();
boolean adv = Minecraft.getMinecraft().gameSettings.advancedItemTooltips;
int id = Item.getIdFromItem(stack.getItem());
lines.addAll(stack.getTooltip(container.getOpeningPlayer(), adv ? TooltipFlags.ADVANCED : TooltipFlags.NORMAL));
lines.set(0, lines.get(0) + " " + id);
if (warn)
{
lines.add(ChatUtil.RED + I18n.format("container.craftingdouble.warning"));
}
drawHoveringText(lines, x, y); //Draw tooltip
}
示例2: func_148213_a
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
protected void func_148213_a(StatCrafting p_148213_1_, int p_148213_2_, int p_148213_3_)
{
if (p_148213_1_ != null)
{
Item item = p_148213_1_.func_150959_a();
ItemStack itemstack = new ItemStack(item);
String s = itemstack.getUnlocalizedName();
String s1 = ("" + I18n.format(s + ".name", new Object[0])).trim();
if (s1.length() > 0)
{
int i = p_148213_2_ + 12;
int j = p_148213_3_ - 12;
int k = GuiStats.this.fontRendererObj.getStringWidth(s1);
GuiStats.this.drawGradientRect(i - 3, j - 3, i + k + 3, j + 8 + 3, -1073741824, -1073741824);
GuiStats.this.fontRendererObj.drawStringWithShadow(s1, (float)i, (float)j, -1);
}
}
}
示例3: initGui
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
this.buttonList.clear();
Keyboard.enableRepeatEvents(true);
this.field_175315_a = I18n.format("createWorld.customize.custom.presets.title", new Object[0]);
this.field_175313_s = I18n.format("createWorld.customize.presets.share", new Object[0]);
this.field_175312_t = I18n.format("createWorld.customize.presets.list", new Object[0]);
this.field_175317_i = new GuiTextField(2, this.fontRendererObj, 50, 40, this.width - 100, 20);
this.field_175311_g = new GuiScreenCustomizePresets.ListPreset();
this.field_175317_i.setMaxStringLength(2000);
this.field_175317_i.setText(this.field_175314_r.func_175323_a());
this.buttonList.add(this.field_175316_h = new GuiButton(0, this.width / 2 - 102, this.height - 27, 100, 20, I18n.format("createWorld.customize.presets.select", new Object[0])));
this.buttonList.add(new GuiButton(1, this.width / 2 + 3, this.height - 27, 100, 20, I18n.format("gui.cancel", new Object[0])));
this.func_175304_a();
}
示例4: initGui
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
this.title = I18n.format("of.options.otherTitle", new Object[0]);
this.buttonList.clear();
for (int i = 0; i < enumOptions.length; ++i)
{
GameSettings.Options gamesettings$options = enumOptions[i];
int j = this.width / 2 - 155 + i % 2 * 160;
int k = this.height / 6 + 21 * (i / 2) - 12;
if (!gamesettings$options.getEnumFloat())
{
this.buttonList.add(new GuiOptionButtonOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.settings.getKeyBinding(gamesettings$options)));
}
else
{
this.buttonList.add(new GuiOptionSliderOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options));
}
}
this.buttonList.add(new GuiButton(210, this.width / 2 - 100, this.height / 6 + 168 + 11 - 44, I18n.format("of.options.other.reset", new Object[0])));
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168 + 11, I18n.format("gui.done", new Object[0])));
}
示例5: initGui
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
Keyboard.enableRepeatEvents(true);
this.buttonList.clear();
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 18, I18n.format("addServer.add", new Object[0])));
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 18, I18n.format("gui.cancel", new Object[0])));
this.buttonList.add(this.serverResourcePacks = new GuiButton(2, this.width / 2 - 100, this.height / 4 + 72, I18n.format("addServer.resourcePack", new Object[0]) + ": " + this.serverData.getResourceMode().getMotd().getFormattedText()));
this.serverNameField = new GuiTextField(0, this.fontRendererObj, this.width / 2 - 100, 66, 200, 20);
this.serverNameField.setFocused(true);
this.serverNameField.setText(this.serverData.serverName);
this.serverIPField = new GuiTextField(1, this.fontRendererObj, this.width / 2 - 100, 106, 200, 20);
this.serverIPField.setMaxStringLength(128);
this.serverIPField.setText(this.serverData.serverIP);
this.serverIPField.func_175205_a(this.field_181032_r);
((GuiButton)this.buttonList.get(0)).enabled = this.serverIPField.getText().length() > 0 && this.serverIPField.getText().split(":").length > 0 && this.serverNameField.getText().length() > 0;
}
示例6: playerName
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
@SubscribeEvent
public void playerName(PlayerEvent.NameFormat event) {
if(Minecraft.getMinecraft().player != null && WeaponsCapability.get(event.getEntityPlayer()).isDisguised()) {
String username=WeaponsCapability.get(event.getEntityPlayer()).getDisguiseType().substring(2);
if(TF2Util.isOnSameTeam(Minecraft.getMinecraft().player, event.getEntityPlayer())) {
event.setDisplayname(event.getDisplayname()+" ["+username+"]");
}
else {
if(WeaponsCapability.get(event.getEntityPlayer()).getDisguiseType().startsWith("M:")) {
if(event.getEntityPlayer().getCapability(TF2weapons.WEAPONS_CAP, null).entityDisguise != null){
event.setDisplayname(TextFormatting.RESET+event.getEntityPlayer().getCapability(TF2weapons.WEAPONS_CAP, null).entityDisguise.getDisplayName().getFormattedText());
}
else
event.setDisplayname(TextFormatting.RESET+I18n.format("entity."+username+".name"));
}
else
event.setDisplayname(ScorePlayerTeam.formatPlayerName(Minecraft.getMinecraft().world.getScoreboard().getPlayersTeam(username), username));
}
}
}
示例7: initGui
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
int i = 0;
this.field_146507_a = I18n.format("options.sounds.title", new Object[0]);
this.field_146508_h = I18n.format("options.off", new Object[0]);
this.buttonList.add(new GuiScreenOptionsSounds.Button(SoundCategory.MASTER.getCategoryId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), SoundCategory.MASTER, true));
i = i + 2;
for (SoundCategory soundcategory : SoundCategory.values())
{
if (soundcategory != SoundCategory.MASTER)
{
this.buttonList.add(new GuiScreenOptionsSounds.Button(soundcategory.getCategoryId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), soundcategory, false));
++i;
}
}
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0])));
}
示例8: initGui
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
@Override
public void initGui() {
super.initGui();
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
statusStat = addAnimatedStat("Security Status", new ItemStack(Blockss.SECURITY_STATION), 0xFFFFAA00, false);
accessStat = addAnimatedStat("Shared Users", new ItemStack(Items.SKULL, 1, 3), 0xFF005500, false);
Rectangle accessButtonRectangle = accessStat.getButtonScaledRectangle(145, 10, 20, 20);
addButton = getButtonFromRectangle(1, accessButtonRectangle, "+");
rebootButton = new GuiButton(2, xStart + 110, yStart + 20, 60, 20, "Reboot");
sharedUserTextField = getTextFieldFromRectangle(accessStat.getButtonScaledRectangle(20, 15, 120, 10));
accessStat.addWidget(sharedUserTextField);
accessStat.addWidget(addButton);
buttonList.add(new GuiButton(3, guiLeft + 108, guiTop + 103, 64, 20, I18n.format("gui.securityStation.test")));
buttonList.add(rebootButton);
buttonList.add(new GuiButton(-1, guiLeft + 108, guiTop + 125, 64, 20, I18n.format("gui.universalSensor.button.showRange")));
updateUserRemoveButtons();
nodeHandler = new NetworkConnectionBackground(this, te, xStart + 25, yStart + 30, 18, 0xFF2222FF);
}
示例9: initGui
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
@Override
public void initGui() {
super.initGui();
String title = I18n.format("item." + module.getType() + ".name");
addLabel(title, width / 2 - fontRenderer.getStringWidth(title) / 2, guiTop + 5);
advancedMode = new GuiCheckBox(0, guiLeft + 6, guiTop + 15, 0xFF404040, "gui.tubeModule.advancedConfig").setTooltip(I18n.format("gui.tubeModule.advancedConfig.tooltip"));
advancedMode.checked = false;
addWidget(advancedMode);
thresholdField = new WidgetTextFieldNumber(fontRenderer, guiLeft + 110, guiTop + 33, 30, fontRenderer.FONT_HEIGHT).setDecimals(1);
addWidget(thresholdField);
if (module instanceof TubeModuleRedstoneReceiving) {
thresholdField.setValue(((TubeModuleRedstoneReceiving) module).getThreshold());
addLabel(I18n.format("gui.tubeModule.simpleConfig.threshold"), guiLeft + 6, guiTop + 33);
} else {
thresholdField.setValue(module.lowerBound);
addLabel(I18n.format("gui.tubeModule.simpleConfig.turn"), guiLeft + 6, guiTop + 33);
moreOrLessButton = new GuiButtonSpecial(1, guiLeft + 85, guiTop + 28, 20, 20, module.lowerBound < module.higherBound ? ">" : "<");
moreOrLessButton.setTooltipText(I18n.format(module.lowerBound < module.higherBound ? "gui.tubeModule.simpleConfig.higherThan" : "gui.tubeModule.simpleConfig.lowerThan"));
addWidget(moreOrLessButton);
}
addLabel(I18n.format("gui.general.bar"), guiLeft + 145, guiTop + 34);
}
示例10: initGui
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
this.field_146628_f = I18n.format("selectWorld.title", new Object[0]);
try
{
this.func_146627_h();
}
catch (AnvilConverterException anvilconverterexception)
{
logger.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception);
this.mc.displayGuiScreen(new GuiErrorScreen("Unable to load worlds", anvilconverterexception.getMessage()));
return;
}
this.field_146637_u = I18n.format("selectWorld.world", new Object[0]);
this.field_146636_v = I18n.format("selectWorld.conversion", new Object[0]);
this.field_146635_w[WorldSettings.GameType.SURVIVAL.getID()] = I18n.format("gameMode.survival", new Object[0]);
this.field_146635_w[WorldSettings.GameType.CREATIVE.getID()] = I18n.format("gameMode.creative", new Object[0]);
this.field_146635_w[WorldSettings.GameType.ADVENTURE.getID()] = I18n.format("gameMode.adventure", new Object[0]);
this.field_146635_w[WorldSettings.GameType.SPECTATOR.getID()] = I18n.format("gameMode.spectator", new Object[0]);
this.field_146638_t = new GuiSelectWorld.List(this.mc);
this.field_146638_t.registerScrollButtons(4, 5);
this.func_146618_g();
}
示例11: initGui
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
@Override
public void initGui()
{
int yBase = this.height / 2 - (106 / 2);
connectButton = new GuiButton(0, width / 2 - 40, this.height - 30, 80, 20, I18n.format("creeperhost.multiplayer.connect"));
if (canConnect)
{
buttonList.add(connectButton);
}
cancelButton = new GuiButton(1, width - 100, this.height - 30, 80, 20, I18n.format("creeperhost.multiplayer.cancel"));
buttonList.add(cancelButton);
String checkText = I18n.format("creeperhost.multiplayer.addlist");
int checkWidth = 11 + 2 + fontRendererObj.getStringWidth(checkText);
checkBox = new GuiCheckBox(2, (width / 2) - (checkWidth / 2), yBase + 36 + 30 + 30, checkText, addToServerList);
buttonList.add(checkBox);
}
示例12: drawGuiContainerForegroundLayer
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
RenderHelper.disableStandardItemLighting();
this.drawCenteredString(this.fontRendererObj, I18n.format("tile.beacon.primary", new Object[0]), 62, 10, 14737632);
this.drawCenteredString(this.fontRendererObj, I18n.format("tile.beacon.secondary", new Object[0]), 169, 10, 14737632);
for (GuiButton guibutton : this.buttonList)
{
if (guibutton.isMouseOver())
{
guibutton.drawButtonForegroundLayer(mouseX - this.guiLeft, mouseY - this.guiTop);
break;
}
}
RenderHelper.enableGUIStandardItemLighting();
}
示例13: drawScreen
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
/**
* Draws the screen and all the components in it.
*/
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
this.drawDefaultBackground();
this.drawCenteredString(this.fontRendererObj, I18n.format("advMode.setCommand", new Object[0]), this.width / 2, 20, 16777215);
this.drawString(this.fontRendererObj, I18n.format("advMode.command", new Object[0]), this.width / 2 - 150, 37, 10526880);
this.commandTextField.drawTextBox();
int i = 75;
int j = 0;
this.drawString(this.fontRendererObj, I18n.format("advMode.nearestPlayer", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880);
this.drawString(this.fontRendererObj, I18n.format("advMode.randomPlayer", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880);
this.drawString(this.fontRendererObj, I18n.format("advMode.allPlayers", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880);
this.drawString(this.fontRendererObj, I18n.format("advMode.allEntities", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880);
this.drawString(this.fontRendererObj, "", this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880);
if (!this.previousOutputTextField.getText().isEmpty())
{
i = i + j * this.fontRendererObj.FONT_HEIGHT + 1;
this.drawString(this.fontRendererObj, I18n.format("advMode.previousOutput", new Object[0]), this.width / 2 - 150, i, 10526880);
this.previousOutputTextField.drawTextBox();
}
super.drawScreen(mouseX, mouseY, partialTicks);
}
示例14: drawScreen
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
/**
* Draws the screen and all the components in it.
*/
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
this.drawDefaultBackground();
if (this.networkManager == null)
{
this.drawCenteredString(this.fontRendererObj, I18n.format("connect.connecting", new Object[0]), this.width / 2, this.height / 2 - 50, 16777215);
}
else
{
this.drawCenteredString(this.fontRendererObj, I18n.format("connect.authorizing", new Object[0]), this.width / 2, this.height / 2 - 50, 16777215);
}
super.drawScreen(mouseX, mouseY, partialTicks);
}
示例15: initGui
import net.minecraft.client.resources.I18n; //導入依賴的package包/類
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
int i = 0;
this.title = I18n.format("options.skinCustomisation.title", new Object[0]);
for (EnumPlayerModelParts enumplayermodelparts : EnumPlayerModelParts.values())
{
this.buttonList.add(new GuiCustomizeSkin.ButtonPart(enumplayermodelparts.getPartId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20, enumplayermodelparts));
++i;
}
if (i % 2 == 1)
{
++i;
}
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 24 * (i >> 1), I18n.format("gui.done", new Object[0])));
}