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


Java ItemStack.clearCustomName方法代码示例

本文整理汇总了Java中net.minecraft.item.ItemStack.clearCustomName方法的典型用法代码示例。如果您正苦于以下问题:Java ItemStack.clearCustomName方法的具体用法?Java ItemStack.clearCustomName怎么用?Java ItemStack.clearCustomName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.item.ItemStack的用法示例。


在下文中一共展示了ItemStack.clearCustomName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateItemName

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * used by the Anvil GUI to update the Item Name being typed by the player
 */
public void updateItemName(String newName)
{
    this.repairedItemName = newName;

    if (this.getSlot(2).getHasStack())
    {
        ItemStack itemstack = this.getSlot(2).getStack();

        if (StringUtils.isBlank(newName))
        {
            itemstack.clearCustomName();
        }
        else
        {
            itemstack.setStackDisplayName(this.repairedItemName);
        }
    }

    this.updateRepairOutput();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:ContainerRepair.java

示例2: addInformation

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
	 if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("defieritem")){
		 tooltip.add("Blank Pattern");
	 }else{
		 ItemStack stored = new ItemStack(stack.getTagCompound().getCompoundTag("defieritem"));
		 DefierRecipe recipe = DefierRecipeRegistry.findRecipeForStack(stored);
		 if(recipe == null){
			 tooltip.add(TextFormatting.RED + "Unknown Recipe");
		 }else{
			 stored.clearCustomName();
			 tooltip.add("Item: " + stored.getDisplayName());
			 tooltip.add("Energy Cost: " + Defier.LARGE_NUMBER.format(recipe.getCost()) + "RF");
		 }
	 }
}
 
开发者ID:tiffit,项目名称:Defier,代码行数:17,代码来源:PatternItem.java

示例3: drawGuiContainerForegroundLayer

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
	super.drawGuiContainerForegroundLayer(mouseX, mouseY);
	int mx = mouseX - guiLeft;
	int my = mouseY - guiTop;
	Slot patternSlot = container.getSlot(0);
	if(patternSlot.getHasStack()){
		ItemStack stored = new ItemStack(patternSlot.getStack().getTagCompound().getCompoundTag("defieritem"));
		stored.clearCustomName();
		drawCenteredString(fontRenderer, stored.getDisplayName(), xSize/2, 50, 0x00b5c6);
		DefierRecipe recipe = DefierRecipeRegistry.findRecipeForStack(stored);
		drawCenteredString(fontRenderer, Defier.LARGE_NUMBER.format(te.rf.getEnergyStored()) + "RF/" + Defier.LARGE_NUMBER.format(recipe.getCost()) + "RF", xSize/2, 60, 0xffffff);
		double percent = te.rf.getEnergyStored()/(double)recipe.getCost();
		drawCenteredString(fontRenderer, ItemStack.DECIMALFORMAT.format(percent*100) + "%", xSize/2, 70, 0xffffff);
	}
}
 
开发者ID:tiffit,项目名称:Defier,代码行数:17,代码来源:DefierGui.java


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