當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。