本文整理汇总了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);
}
}