本文整理匯總了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();
}
示例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");
}
}
}
示例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);
}
}