当前位置: 首页>>代码示例>>Java>>正文


Java I18n类代码示例

本文整理汇总了Java中net.minecraft.util.text.translation.I18n的典型用法代码示例。如果您正苦于以下问题:Java I18n类的具体用法?Java I18n怎么用?Java I18n使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


I18n类属于net.minecraft.util.text.translation包,在下文中一共展示了I18n类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getItemStackDisplayName

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
public String getItemStackDisplayName(ItemStack stack)
{
    if (stack.getMetadata() == 3 && stack.hasTagCompound())
    {
        if (stack.getTagCompound().hasKey("SkullOwner", 8))
        {
            return I18n.translateToLocalFormatted("item.skull.player.name", new Object[] {stack.getTagCompound().getString("SkullOwner")});
        }

        if (stack.getTagCompound().hasKey("SkullOwner", 10))
        {
            NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("SkullOwner");

            if (nbttagcompound.hasKey("Name", 8))
            {
                return I18n.translateToLocalFormatted("item.skull.player.name", new Object[] {nbttagcompound.getString("Name")});
            }
        }
    }

    return super.getItemStackDisplayName(stack);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:ItemSkull.java

示例2: drawScreen

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    if(mc == null)
    {
        mc = Minecraft.getMinecraft();
        fontRenderer = mc.fontRenderer;
    }
    drawDefaultBackground();

    GlStateManager.color(1F, 1F, 1F, 1F);
    this.mc.getTextureManager().bindTexture(texBackground);
    this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);

    trackList.drawScreen(mouseX, mouseY, partialTicks);

    super.drawScreen(mouseX, mouseY, partialTicks);

    GlStateManager.pushMatrix();
    GlStateManager.scale(0.5F, 0.5F, 0.5F);
    fontRenderer.drawString(I18n.translateToLocal("glass.gui.availableProjectors"), (guiLeft + 5) / 0.5F, (guiTop + 5) / 0.5F, 16777215, true);
    GlStateManager.popMatrix();
}
 
开发者ID:iChun,项目名称:GeneralLaymansAestheticSpyingScreen,代码行数:24,代码来源:GuiProjectorSetter.java

示例3: drawSlot

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
@Override
protected void drawSlot(int idx, int right, int top, int height, Tessellator tess)
{
    if(idx >= 0 && idx < channels.size())
    {
        FontRenderer font = this.parent.getFontRenderer();
        String channel = channels.get(idx);
        GlStateManager.pushMatrix();
        GlStateManager.scale(0.5F, 0.5F, 1F);
        String name = font.trimStringToWidth(channel.substring(channel.indexOf(":") + 1), (listWidth - 10) * 2);
        if(channel.startsWith("public:"))
        {
            name = I18n.translateToLocal("glass.gui.public") + " " + name;
        }
        font.drawString(name, (this.left + 2) * 2, top * 2, idx % 2 == 0 ? 0xFFFFFF : 0xAAAAAA);
        GlStateManager.popMatrix();
    }
}
 
开发者ID:iChun,项目名称:GeneralLaymansAestheticSpyingScreen,代码行数:19,代码来源:GuiChannelList.java

示例4: getDeathMessage

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
/**
 * Returns the message to be displayed on player death.
 */
@Override
public ITextComponent getDeathMessage(EntityLivingBase p_151519_1_) {
	// ItemStack itemstack = this.damageSourceEntity instanceof
	// EntityLivingBase ?
	// ((EntityLivingBase)this.damageSourceEntity).getHeldItem(EnumHand.MAIN_HAND)
	// : null;
	if (this.getTrueSource() == TF2weapons.dummyEnt)
		return new TextComponentTranslation("death.attack.explosion", p_151519_1_.getDisplayName());
	String s = "death.attack." + this.damageType;
	String s1 = s + ".item";
	return weapon != null && I18n.canTranslate(s1)
			? new TextComponentTranslation(s1,
					new Object[] { p_151519_1_.getDisplayName(), this.getTrueSource().getDisplayName(),
							weapon.getDisplayName() })
			: new TextComponentTranslation(s,
					new Object[] { p_151519_1_.getDisplayName(), this.getTrueSource().getDisplayName() });
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:21,代码来源:DamageSourceProjectile.java

示例5: getCraftingResult

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting inv)
{
	ItemStack outputStack = ItemStack.EMPTY;
	if (countSlotsNotEmpty(inv) <= 1) return outputStack;

	Collection<PotionEffect> effects = new ArrayList<PotionEffect>();

	for (int i = 0; i < inv.getSizeInventory(); i++)
	{
		ItemStack stack = inv.getStackInSlot(i);
		if (!stack.isEmpty())
		{
			if (outputStack.isEmpty()) outputStack = getOutputStack(stack);
			if (outputStack.isEmpty()) return outputStack;

			effects.addAll(getEffectsFromStack(stack));
		}
	}

	outputStack = PotionUtils.appendEffects(outputStack, effects);
	outputStack.setStackDisplayName(I18n.translateToLocal("item.combined_" + outputStack.getItem().getUnlocalizedName().substring(5) + ".name"));

	return outputStack;
}
 
开发者ID:crazysnailboy,项目名称:CombinedPotions,代码行数:26,代码来源:RecipeCombinedPotions2.java

示例6: getItemStackDisplayName

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public String getItemStackDisplayName(ItemStack p_77653_1_) {
	// (I18n.translateToLocal(this.getUnlocalizedName()+".name")).trim();
	int i = p_77653_1_.getItemDamage() / 2;
	String s1 = "sentry";
	switch (i) {
	case 10:
		s1 = "dispenser";
		break;
	case 11:
		s1 = "teleporter";
		break;
	}
	return I18n.translateToLocal(this.getUnlocalizedName() + "." + s1 + ".name");
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:17,代码来源:ItemBuildingBox.java

示例7: addInformation

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
/**
 * allows items to add custom lines of information to the mouseover description
 */
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
    if (stack.hasTagCompound())
    {
        NBTTagCompound nbttagcompound = stack.getTagCompound();
        String s = nbttagcompound.getString("author");

        if (!StringUtils.isNullOrEmpty(s))
        {
            tooltip.add(TextFormatting.GRAY + I18n.translateToLocalFormatted("book.byAuthor", new Object[] {s}));
        }

        tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("book.generation." + nbttagcompound.getInteger("generation")));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:ItemWrittenBook.java

示例8: initGui

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
@Override
public void initGui()
{
    super.initGui();
    trackListBottom -= 22;
    trackList = new GuiTrackList(this, 158, ySize - 22, guiTop + 17, trackListBottom, guiLeft + 7, 8, playlistView ? playlist : tracks);

    this.mc.player.openContainer = this.containerInstrumentPlayer;

    for(GuiButton btn : buttonList)
    {
        if(btn.id == ID_CONFIRM)
        {
            btn.displayString = I18n.translateToLocal("gui.done");
        }
    }
}
 
开发者ID:iChun,项目名称:Clef,代码行数:18,代码来源:GuiPlayTrackBlock.java

示例9: addButtons

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
@Override
public void addButtons()
{
    if(!playlistView)
    {
        super.addButtons();
        buttonList.add(new GuiButton(ID_ADD_PLAYLIST, guiLeft + 116 - 55, guiTop + 205, 50, 20, I18n.translateToLocal("clef.gui.block.addPlaylist")));
        buttonList.add(new GuiButton(ID_VIEW_PLAYLIST, guiLeft + 116, guiTop + 205, 50, 20, I18n.translateToLocal("clef.gui.block.viewPlaylist")));
    }
    else
    {
        buttonList.add(new GuiButton(ID_REPEAT, guiLeft + 179, guiTop + 51, 72, 20, I18n.translateToLocal(repeat == 0 ? "clef.gui.block.repeatNone" : repeat == 1 ? "clef.gui.block.repeatAll" :"clef.gui.block.repeatOne")));
        buttonList.add(new GuiButton(ID_SHUFFLE, guiLeft + 179, guiTop + 94, 72, 20, I18n.translateToLocal(shuffle == 1 ? "gui.yes" : "gui.no")));

        buttonList.add(new GuiButton(ID_VIEW_ALL, guiLeft + 116, guiTop + 205, 50, 20, I18n.translateToLocal("clef.gui.block.viewAll")));
        buttonList.add(new GuiButton(ID_ORDER_UP, guiLeft + 6, guiTop + 205, 20, 20, ""));
        buttonList.add(new GuiButton(ID_ORDER_DOWN, guiLeft + 30, guiTop + 205, 20, 20, ""));
        buttonList.add(new GuiButton(ID_DELETE, guiLeft + 54, guiTop + 205, 20, 20, ""));
    }
}
 
开发者ID:iChun,项目名称:Clef,代码行数:21,代码来源:GuiPlayTrackBlock.java

示例10: getDeathMessage

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
/**
 * Returns the message to be displayed on player death.
 */
@Override
public ITextComponent getDeathMessage(EntityLivingBase p_151519_1_) {
	// ItemStack itemstack = this.damageSourceEntity instanceof
	// EntityLivingBase ?
	// ((EntityLivingBase)this.damageSourceEntity).getHeldItem(EnumHand.MAIN_HAND)
	// : null;
	String s = "death.attack." + this.damageType;
	String s1 = s + ".item";
	return !weapon.isEmpty() && I18n.canTranslate(s1)
			? new TextComponentTranslation(s1,
					new Object[] { p_151519_1_.getDisplayName(), this.getTrueSource().getDisplayName(),
							weapon.getDisplayName() })
			: new TextComponentTranslation(s,
					new Object[] { p_151519_1_.getDisplayName(), this.getTrueSource().getDisplayName() });
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:19,代码来源:DamageSourceDirect.java

示例11: getItemStackDisplayName

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
@Override
@Nonnull
public String getItemStackDisplayName(@Nonnull ItemStack stack)
{
    FluidStack fluidStack = getFluid(stack);
    if (fluidStack == null)
    {
        return super.getItemStackDisplayName(stack);
    }

    String unloc = this.getUnlocalizedNameInefficiently(stack);

    if (I18n.canTranslate(unloc + "." + fluidStack.getFluid().getName()))
    {
        return I18n.translateToLocal(unloc + "." + fluidStack.getFluid().getName());
    }

    return I18n.translateToLocalFormatted(unloc + ".filled.name", fluidStack.getLocalizedName());
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:20,代码来源:ItemFluidContainer.java

示例12: onItemTooltip

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent ev)
{
	ItemStack itemStack = ev.getItemStack();

	if (itemStack.getItem() instanceof IClassifiedItem)
	{
		IClassifiedItem classifiedItem = (IClassifiedItem)itemStack.getItem();
		String transItemClass = I18n.translateToLocal("compositegear.itemclass");

		ev.getToolTip().add(1, transItemClass + ": " + classifiedItem.getItemClass().getLocalized());
		
		if (itemStack.getItem() instanceof ItemCGArmor) {
			String transItemDesc = I18n.translateToLocal("compositegear.itemdesc");
			
			
			if (((ItemCGArmor)itemStack.getItem()).hasDescription()) {
				String descriptionString = I18n.translateToLocal(itemStack.getItem().getUnlocalizedName() + ".description");
				ev.getToolTip().add(2, transItemDesc + ": " + descriptionString);
			}
		}
	}
}
 
开发者ID:TwilightWingsStudio,项目名称:CompositeGear,代码行数:25,代码来源:ClientEventHandler.java

示例13: getName

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
/**
 * Get the name of this object. For players this returns their username
 */
public String getName()
{
    if (this.hasCustomName())
    {
        return this.getCustomNameTag();
    }
    else
    {
        String s = EntityList.getEntityString(this);

        if (s == null)
        {
            s = "generic";
        }

        return I18n.translateToLocal("entity." + s + ".name");
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:Entity.java

示例14: setRabbitType

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
public void setRabbitType(int rabbitTypeId)
{
    if (rabbitTypeId == 99)
    {
        this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(8.0D);
        this.tasks.addTask(4, new EntityRabbit.AIEvilAttack(this));
        this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWolf.class, true));

        if (!this.hasCustomName())
        {
            this.setCustomNameTag(I18n.translateToLocal("entity.KillerBunny.name"));
        }
    }

    this.dataManager.set(RABBIT_TYPE, Integer.valueOf(rabbitTypeId));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:EntityRabbit.java

示例15: getItemStackDisplayName

import net.minecraft.util.text.translation.I18n; //导入依赖的package包/类
public String getItemStackDisplayName(ItemStack stack)
{
    String s = ("" + I18n.translateToLocal(this.getUnlocalizedName() + ".name")).trim();
    String s1 = EntityList.func_191302_a(func_190908_h(stack));

    if (s1 != null)
    {
        s = s + " " + I18n.translateToLocal("entity." + s1 + ".name");
    }

    return s;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:ItemMonsterPlacer.java


注:本文中的net.minecraft.util.text.translation.I18n类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。