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


Java ItemStack.getDisplayName方法代码示例

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


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

示例1: RenderBlockTarget

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public RenderBlockTarget(World world, EntityPlayer player, BlockPos pos, TileEntity te,
                         BlockTrackUpgradeHandler blockTracker) {
    this.world = world;
    this.player = player;
    this.pos = pos;
    this.te = te;
    this.blockTracker = blockTracker;
    // oldTicksExisted = entity.ticksExisted;
    String title = world.getBlockState(pos).getBlock().getLocalizedName();
    if (title.contains(".name")) {
        try {
            IBlockState state = world.getBlockState(pos);
            ItemStack stack = state.getBlock().getPickBlock(state, FMLClientHandler.instance().getClient().objectMouseOver, world, pos, FMLClientHandler.instance().getClientPlayerEntity());
            if (!stack.isEmpty()) title = stack.getDisplayName();
        } catch (Throwable e) {
        }
    }
    if (title.contains(".name")) {
        ITextComponent text = te.getDisplayName();
        title = text == null ? "???" : te.getDisplayName().getFormattedText();
    }
    stat = new GuiAnimatedStat(null, title, "", 20, -20, 0x3000AA00, null, false);
    stat.setMinDimensionsAndReset(0, 0);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:25,代码来源:RenderBlockTarget.java

示例2: handleItemState

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
@Nonnull
public IBakedModel handleItemState(@Nonnull IBakedModel originalModel, @Nonnull ItemStack stack,
		@Nullable World world, @Nullable EntityLivingBase entity) {
	
	String name = stack.getDisplayName();
	
	if (!cache.containsKey(name)) {
		ModelKnowledgeBook model = (ModelKnowledgeBook) originalModel;
		TextureAtlasSprite fontSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(font2.toString());
		
		BakedModelKnowledgeBook bakedBakedModel = rebake(model, name);
		cache.put(name, bakedBakedModel);

		return bakedBakedModel;
	}
	return cache.get(name);
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:19,代码来源:ModelKnowledgeBook.java

示例3: setItemValues

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public void setItemValues(ItemStack stack, boolean p_175112_2_)
{
    this.patterns = null;
    NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag");

    if (nbttagcompound != null && nbttagcompound.hasKey("Patterns", 9))
    {
        this.patterns = nbttagcompound.getTagList("Patterns", 10).copy();
    }

    this.baseColor = p_175112_2_ ? func_190616_d(stack) : ItemBanner.getBaseColor(stack);
    this.patternList = null;
    this.colorList = null;
    this.patternResourceLocation = "";
    this.patternDataSet = true;
    this.field_190617_a = stack.hasDisplayName() ? stack.getDisplayName() : null;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:TileEntityBanner.java

示例4: matchesSearch

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private boolean matchesSearch(BlockPos pos) {
	if ("".equals(this.searchField.getText()))
		return true;

	IBlockState state = this.entity.getWorld().getBlockState(pos);
	
	if (state.getBlock() == RezolveMod.REMOTE_SHELL_BLOCK)
		return false;
	
	String searchString = this.searchField.getText();
	ItemStack stack = getItemFromBlock(this.entity, pos);
	
	if (stack == null)
		return false;

	String name = stack.getDisplayName();
	String subName = pos.getX()+", "+pos.getY()+", "+pos.getZ();
	
	if (name.toLowerCase().contains(searchString.toLowerCase()) || subName.toLowerCase().contains(searchString.toLowerCase()))
		return true;
	
 DatabaseServerEntity db = this.entity.getDatabase();    	
	if (db != null) {
		String customName = db.getMachineName(pos);
		if (customName != null && !"".equals(customName)) {
			if (customName.toLowerCase().contains(searchString.toLowerCase()))
				return true;
		}
	}
	
	return false;
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:33,代码来源:RemoteShellGuiContainer.java

示例5: drawGuiContainerForegroundLayer

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {

    super.drawGuiContainerForegroundLayer(mouseX, mouseY);
    
    int rfBarX = 231;
    int rfBarY = 20;
    int rfBarHeight = 88;
    int rfBarWidth = 14;
    
    int usedHeight = rfBarHeight - (int)(this.entity.getEnergyStored(EnumFacing.DOWN) / (double)this.entity.getMaxEnergyStored(EnumFacing.DOWN) * rfBarHeight);
    Gui.drawRect(rfBarX, rfBarY, rfBarX + rfBarWidth, rfBarY + usedHeight, 0xFF000000);

    DatabaseServerEntity db = this.entity.getDatabase();
	this.nameField.setVisible(this.selectedMachine != null && db != null);
	
    if (this.selectedMachine != null) {
    	BlockPos pos = this.selectedMachine;
    	ItemStack stack = getItemFromBlock(this.entity, pos);
    	
    	if (stack != null) {
	    	String name = stack.getDisplayName();
	    	String stackName = stack.getDisplayName();
	    	String position = pos.getX()+", "+pos.getY()+", "+pos.getZ();
	    	
	    	if (!this.nameField.getVisible()) {
	    		this.fontRendererObj.drawString(stackName, 10, 126, 0xFF000000);
	    		this.fontRendererObj.drawString(position, 10, 141, 0xFF666666);
	    	} else {
	    		this.fontRendererObj.drawString(stackName, 10, 141, 0xFF666666);
	    		this.fontRendererObj.drawString(position, 10, 153, 0xFF666666);
	    	}
    	}
    } else {

   		this.fontRendererObj.drawString("Right click a machine for info.", 10, 126, 0xFF666666);
    }
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:39,代码来源:RemoteShellGuiContainer.java

示例6: getItemName

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public String getItemName(ItemStack stack) {
    return (stack.getDisplayName());
}
 
开发者ID:boomboompower,项目名称:TextDisplayer,代码行数:4,代码来源:ItemParser.java


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