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


Java ItemStack.getMetadata方法代码示例

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


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

示例1: smeltItem

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack
 */
public void smeltItem()
{
    if (this.canSmelt())
    {
        ItemStack itemstack = (ItemStack)this.furnaceItemStacks.get(0);
        ItemStack itemstack1 = FurnaceRecipes.instance().getSmeltingResult(itemstack);
        ItemStack itemstack2 = (ItemStack)this.furnaceItemStacks.get(2);

        if (itemstack2.func_190926_b())
        {
            this.furnaceItemStacks.set(2, itemstack1.copy());
        }
        else if (itemstack2.getItem() == itemstack1.getItem())
        {
            itemstack2.func_190917_f(1);
        }

        if (itemstack.getItem() == Item.getItemFromBlock(Blocks.SPONGE) && itemstack.getMetadata() == 1 && !((ItemStack)this.furnaceItemStacks.get(1)).func_190926_b() && ((ItemStack)this.furnaceItemStacks.get(1)).getItem() == Items.BUCKET)
        {
            this.furnaceItemStacks.set(1, new ItemStack(Items.WATER_BUCKET));
        }

        itemstack.func_190918_g(1);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:TileEntityFurnace.java

示例2: matches

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
	boolean key = false;
	ItemStack crate = ItemStack.EMPTY;

	for (int x = 0; x < inv.getSizeInventory(); x++) {
		ItemStack stack = inv.getStackInSlot(x);
		if (!stack.isEmpty())
			if (stack.getItem() == TF2weapons.itemTF2 && stack.getMetadata() == 7) {
				if (!key)
					key = true;
				else
					return false;
			} else if (crate.isEmpty() && stack.getItem() instanceof ItemCrate)
				crate = stack;
			else
				return false;
	}
	// System.out.println("matches "+(australium&&stack2!=null));
	return key && crate != null;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:22,代码来源:OpenCrateRecipe.java

示例3: getUnlocalizedName

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
public String getUnlocalizedName(ItemStack stack) {
	if (stack.getMetadata() == 1)
		return this.getUnlocalizedName()+"_blank";
	else
		return this.getUnlocalizedName();
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:8,代码来源:BundlePatternItem.java

示例4: isHittingPosition

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private boolean isHittingPosition(BlockPos pos)
{
    ItemStack itemstack = this.mc.player.getHeldItemMainhand();
    boolean flag = this.currentItemHittingBlock.func_190926_b() && itemstack.func_190926_b();

    if (!this.currentItemHittingBlock.func_190926_b() && !itemstack.func_190926_b())
    {
        flag = itemstack.getItem() == this.currentItemHittingBlock.getItem() && ItemStack.areItemStackTagsEqual(itemstack, this.currentItemHittingBlock) && (itemstack.isItemStackDamageable() || itemstack.getMetadata() == this.currentItemHittingBlock.getMetadata());
    }

    return pos.equals(this.currentBlock) && flag;
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:13,代码来源:PlayerControllerMP.java

示例5: matches

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    List<ItemStack> list = Lists.newArrayList(this.recipeItems);

    for (int i = 0; i < inv.getHeight(); ++i)
    {
        for (int j = 0; j < inv.getWidth(); ++j)
        {
            ItemStack itemstack = inv.getStackInRowAndColumn(j, i);

            if (itemstack != null)
            {
                boolean flag = false;

                for (ItemStack itemstack1 : list)
                {
                    if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getMetadata() == 32767 || itemstack.getMetadata() == itemstack1.getMetadata()))
                    {
                        flag = true;
                        list.remove(itemstack1);
                        break;
                    }
                }

                if (!flag)
                {
                    return false;
                }
            }
        }
    }

    return list.isEmpty();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:38,代码来源:ShapelessRecipes.java

示例6: getPacket

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public Packet getPacket(ItemStack stack)
{
    if (this.field_176105_d)
    {
        this.field_176105_d = false;
        return new S34PacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.mapDecorations.values(), MapData.this.colors, this.minX, this.minY, this.maxX + 1 - this.minX, this.maxY + 1 - this.minY);
    }
    else
    {
        return this.field_176109_i++ % 5 == 0 ? new S34PacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.mapDecorations.values(), MapData.this.colors, 0, 0, 0, 0) : null;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:13,代码来源:MapData.java

示例7: getRealOredictedItems

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public static NonNullList<ItemStack> getRealOredictedItems(String oredit) {
    NonNullList<ItemStack> stacks = NonNullList.create();
    for (ItemStack ore : OreDictionary.getOres(oredit)) {
        if (ore.getMetadata() == OreDictionary.WILDCARD_VALUE && ore.getItem().getCreativeTab() != null)
            ore.getItem().getSubItems(ore.getItem().getCreativeTab(), stacks);
        else {
            stacks.add(ore);
            break;
        }
    }
    return stacks;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:13,代码来源:RecipeHandlers.java

示例8: storeItemStack

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * stores an itemstack in the users inventory
 */
private int storeItemStack(ItemStack itemStackIn)
{
    for (int i = 0; i < this.mainInventory.length; ++i)
    {
        if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemStackIn.getItem() && this.mainInventory[i].isStackable() && this.mainInventory[i].stackSize < this.mainInventory[i].getMaxStackSize() && this.mainInventory[i].stackSize < this.getInventoryStackLimit() && (!this.mainInventory[i].getHasSubtypes() || this.mainInventory[i].getMetadata() == itemStackIn.getMetadata()) && ItemStack.areItemStackTagsEqual(this.mainInventory[i], itemStackIn))
        {
            return i;
        }
    }

    return -1;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:InventoryPlayer.java

示例9: getTypeInt

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public int getTypeInt(ItemStack stack) {
	return stack.getMetadata();
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:4,代码来源:ItemAmmo.java

示例10: canDispenserPlace

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public boolean canDispenserPlace(World worldIn, BlockPos pos, ItemStack stack)
{
    return stack.getMetadata() == 1 && pos.getY() >= 2 && worldIn.getDifficulty() != EnumDifficulty.PEACEFUL && !worldIn.isRemote ? this.getWitherBasePattern().match(worldIn, pos) != null : false;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:BlockSkull.java

示例11: getBaseColor

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public static int getBaseColor(ItemStack stack)
{
    NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false);
    return nbttagcompound != null && nbttagcompound.hasKey("Base") ? nbttagcompound.getInteger("Base") : stack.getMetadata();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:6,代码来源:TileEntityBanner.java

示例12: canCombine

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private static boolean canCombine(ItemStack stack1, ItemStack stack2)
{
    return stack1.getItem() != stack2.getItem() ? false : (stack1.getMetadata() != stack2.getMetadata() ? false : (stack1.stackSize > stack1.getMaxStackSize() ? false : ItemStack.areItemStackTagsEqual(stack1, stack2)));
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:TileEntityHopper.java

示例13: checkMatch

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Checks if the region of a crafting inventory is match for the recipe.
 */
private boolean checkMatch(InventoryCrafting p_77573_1_, int p_77573_2_, int p_77573_3_, boolean p_77573_4_)
{
    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            int k = i - p_77573_2_;
            int l = j - p_77573_3_;
            ItemStack itemstack = null;

            if (k >= 0 && l >= 0 && k < this.recipeWidth && l < this.recipeHeight)
            {
                if (p_77573_4_)
                {
                    itemstack = this.recipeItems[this.recipeWidth - k - 1 + l * this.recipeWidth];
                }
                else
                {
                    itemstack = this.recipeItems[k + l * this.recipeWidth];
                }
            }

            ItemStack itemstack1 = p_77573_1_.getStackInRowAndColumn(i, j);

            if (itemstack1 != null || itemstack != null)
            {
                if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null)
                {
                    return false;
                }

                if (itemstack.getItem() != itemstack1.getItem())
                {
                    return false;
                }

                if (itemstack.getMetadata() != 32767 && itemstack.getMetadata() != itemstack1.getMetadata())
                {
                    return false;
                }
            }
        }
    }

    return true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:50,代码来源:ShapedRecipes.java

示例14: processCreativeInventoryAction

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * Update the server with an ItemStack in a slot.
 */
public void processCreativeInventoryAction(CPacketCreativeInventoryAction packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());

    if (this.playerEntity.interactionManager.isCreative())
    {
        boolean flag = packetIn.getSlotId() < 0;
        ItemStack itemstack = packetIn.getStack();

        if (!itemstack.func_190926_b() && itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BlockEntityTag", 10))
        {
            NBTTagCompound nbttagcompound = itemstack.getTagCompound().getCompoundTag("BlockEntityTag");

            if (nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z"))
            {
                BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z"));
                TileEntity tileentity = this.playerEntity.world.getTileEntity(blockpos);

                if (tileentity != null)
                {
                    NBTTagCompound nbttagcompound1 = tileentity.writeToNBT(new NBTTagCompound());
                    nbttagcompound1.removeTag("x");
                    nbttagcompound1.removeTag("y");
                    nbttagcompound1.removeTag("z");
                    itemstack.setTagInfo("BlockEntityTag", nbttagcompound1);
                }
            }
        }

        boolean flag1 = packetIn.getSlotId() >= 1 && packetIn.getSlotId() <= 45;
        boolean flag2 = itemstack.func_190926_b() || itemstack.getMetadata() >= 0 && itemstack.func_190916_E() <= 64 && !itemstack.func_190926_b();

        if (flag1 && flag2)
        {
            if (itemstack.func_190926_b())
            {
                this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), ItemStack.field_190927_a);
            }
            else
            {
                this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), itemstack);
            }

            this.playerEntity.inventoryContainer.setCanCraft(this.playerEntity, true);
        }
        else if (flag && flag2 && this.itemDropThreshold < 200)
        {
            this.itemDropThreshold += 20;
            EntityItem entityitem = this.playerEntity.dropItem(itemstack, true);

            if (entityitem != null)
            {
                entityitem.setAgeToCreativeDespawnTime();
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:61,代码来源:NetHandlerPlayServer.java

示例15: storePartialItemStack

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * This function stores as many items of an ItemStack as possible in a matching slot and returns the quantity of
 * left over items.
 */
private int storePartialItemStack(ItemStack itemStackIn)
{
    Item item = itemStackIn.getItem();
    int i = itemStackIn.stackSize;
    int j = this.storeItemStack(itemStackIn);

    if (j < 0)
    {
        j = this.getFirstEmptyStack();
    }

    if (j < 0)
    {
        return i;
    }
    else
    {
        if (this.mainInventory[j] == null)
        {
            this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata());

            if (itemStackIn.hasTagCompound())
            {
                this.mainInventory[j].setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy());
            }
        }

        int k = i;

        if (i > this.mainInventory[j].getMaxStackSize() - this.mainInventory[j].stackSize)
        {
            k = this.mainInventory[j].getMaxStackSize() - this.mainInventory[j].stackSize;
        }

        if (k > this.getInventoryStackLimit() - this.mainInventory[j].stackSize)
        {
            k = this.getInventoryStackLimit() - this.mainInventory[j].stackSize;
        }

        if (k == 0)
        {
            return i;
        }
        else
        {
            i = i - k;
            this.mainInventory[j].stackSize += k;
            this.mainInventory[j].animationsToGo = 5;
            return i;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:57,代码来源:InventoryPlayer.java


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