本文整理汇总了Java中net.minecraft.item.ItemStack.getUnlocalizedName方法的典型用法代码示例。如果您正苦于以下问题:Java ItemStack.getUnlocalizedName方法的具体用法?Java ItemStack.getUnlocalizedName怎么用?Java ItemStack.getUnlocalizedName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.ItemStack
的用法示例。
在下文中一共展示了ItemStack.getUnlocalizedName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_148213_a
import net.minecraft.item.ItemStack; //导入方法依赖的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);
}
}
}
示例2: renderMouseHoverToolTip
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
protected void renderMouseHoverToolTip(StatCrafting p_148213_1_, int p_148213_2_, int p_148213_3_)
{
if (p_148213_1_ != null)
{
Item item = p_148213_1_.getItem();
ItemStack itemstack = new ItemStack(item);
String s = itemstack.getUnlocalizedName();
String s1 = ("" + I18n.format(s + ".name", new Object[0])).trim();
if (!s1.isEmpty())
{
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: addTooltip
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public static void addTooltip(ItemStack stack, World world, List<String> curInfo) {
String info = "gui.tooltip." + stack.getUnlocalizedName();//getItem().getUnlocalizedName();
String translatedInfo = I18n.format(info);
if (!translatedInfo.equals(info)) {
if (PneumaticCraftRepressurized.proxy.isSneakingInGui()) {
translatedInfo = TextFormatting.AQUA + translatedInfo;
if (!Loader.isModLoaded(ModIds.IGWMOD))
translatedInfo += " \\n \\n" + I18n.format("gui.tab.info.assistIGW");
curInfo.addAll(PneumaticCraftUtils.convertStringIntoList(translatedInfo, 40));
} else {
curInfo.add(TextFormatting.AQUA + I18n.format("gui.tooltip.sneakForInfo"));
}
}
}
示例4: addInformation
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, World world, List<String> curInfo, ITooltipFlag flag) {
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(PneumaticCraftUtils.SAVED_TANKS, Constants.NBT.TAG_COMPOUND)) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(PneumaticCraftUtils.SAVED_TANKS);
for (String s : tag.getKeySet()) {
NBTTagCompound tankTag = tag.getCompoundTag(s);
FluidTank tank = new FluidTank(tankTag.getInteger("Amount"));
tank.readFromNBT(tankTag);
FluidStack fluidStack = tank.getFluid();
if (fluidStack != null && fluidStack.amount > 0) {
curInfo.add(fluidStack.getFluid().getLocalizedName(fluidStack) + ": " + fluidStack.amount + "mB");
}
}
}
if (PneumaticCraftRepressurized.proxy.isSneakingInGui()) {
TileEntity te = createTileEntity(world, getDefaultState());
if (te instanceof TileEntityPneumaticBase) {
float pressure = ((TileEntityPneumaticBase) te).dangerPressure;
curInfo.add(TextFormatting.YELLOW + I18n.format("gui.tooltip.maxPressure", pressure));
}
}
String info = "gui.tab.info." + stack.getUnlocalizedName();
String translatedInfo = I18n.format(info);
if (!translatedInfo.equals(info)) {
if (PneumaticCraftRepressurized.proxy.isSneakingInGui()) {
translatedInfo = TextFormatting.AQUA + translatedInfo.substring(2);
if (!Loader.isModLoaded(ModIds.IGWMOD))
translatedInfo += " \\n \\n" + I18n.format("gui.tab.info.assistIGW");
curInfo.addAll(PneumaticCraftUtils.convertStringIntoList(translatedInfo, 40));
} else {
curInfo.add(TextFormatting.AQUA + I18n.format("gui.tooltip.sneakForInfo"));
}
}
}
示例5: getDrawItemFromItemStack
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/** Attempt to break the item on this itemstack into a type/variant/colour which we can use for communication with the Malmo platform.
* @param is the ItemStack containing the item we are attempting to deconstruct.
* @return an XML DrawItem object containing the item's type, variant, colour etc.
*/
public static DrawItem getDrawItemFromItemStack(ItemStack is)
{
if (is == null)
return null;
DrawItem di = new DrawItem();
String name = is.getUnlocalizedName(); // Get unlocalised name from the stack, not the stack's item - this ensures we keep the metadata.
if (is.getHasSubtypes())
{
// If the item has subtypes, then there are varieties - eg different colours, types, etc.
// Attempt to map from these subtypes back to variant/colour.
// Do this by decomposing the unlocalised name:
List<String> itemParts = new ArrayList<String>(Arrays.asList(name.split("\\.")));
if (is.getItem() instanceof ItemMonsterPlacer)
{
// Special case for eggs:
itemParts.add(ItemMonsterPlacer.getEntityName(is));
}
// First part will be "tile" or "item".
// Second part will be the item itself (eg "dyePowder" or "stainedGlass" etc).
// Third part will be the variant, colour etc.
Colour col = null;
Variation var = null;
for (int part = 2; part < itemParts.size(); part++)
{
String section = itemParts.get(part);
// First see if this matches a colour:
if (col == null)
{
col = attemptToGetAsColour(section);
if (col == null && var == null) // If it wasn't a colour, check to see if it was a variant:
var = attemptToGetAsVariant(section, is);
}
else if (var == null)
var = attemptToGetAsVariant(section, is);
}
di.setColour(col);
di.setVariant(var);
}
// Use the item registry name for the item - this is what we use in Types.XSD
Object obj = Item.itemRegistry.getNameForObject(is.getItem());
String publicName;
if (obj instanceof ResourceLocation)
publicName = ((ResourceLocation)obj).getResourcePath();
else
publicName = obj.toString();
di.setType(publicName);
return di;
}