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


Java Item.getIdFromItem方法代码示例

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


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

示例1: call

import net.minecraft.item.Item; //导入方法依赖的package包/类
@Override
public void call(String[] args) throws CmdException
{
	if(args.length == 0)
		throw new CmdSyntaxError();
	if(!WMinecraft.getPlayer().capabilities.isCreativeMode)
		throw new CmdError("Creative mode only.");
	ItemStack item = WMinecraft.getPlayer().inventory.getCurrentItem();
	if(item == null || Item.getIdFromItem(item.getItem()) != 387)
		throw new CmdError(
			"You are not holding a written book in your hand.");
	String author = args[0];
	for(int i = 1; i < args.length; i++)
		author += " " + args[i];
	item.setTagInfo("author", new NBTTagString(author));
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:17,代码来源:AuthorCmd.java

示例2: initItemDepleteStats

import net.minecraft.item.Item; //导入方法依赖的package包/类
private static void initItemDepleteStats()
{
    for (Item item : net.minecraftforge.fml.common.registry.GameData.getItemRegistry().typeSafeIterable())
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = getItemName(item);

            if (s != null && item.isDamageable())
            {
                OBJECT_BREAK_STATS[i] = (new StatCrafting("stat.breakItem.", s, new TextComponentTranslation("stat.breakItem", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
            }
        }
    }

    replaceAllSimilarBlocks(OBJECT_BREAK_STATS, true);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:StatList.java

示例3: initStats

import net.minecraft.item.Item; //导入方法依赖的package包/类
private static void initStats()
{
    for (Item item : Item.itemRegistry)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = func_180204_a(item);

            if (s != null)
            {
                objectUseStats[i] = (new StatCrafting("stat.useItem.", s, new ChatComponentTranslation("stat.useItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat();

                if (!(item instanceof ItemBlock))
                {
                    itemStats.add((StatCrafting)objectUseStats[i]);
                }
            }
        }
    }

    replaceAllSimilarBlocks(objectUseStats);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:StatList.java

示例4: initPickedUpAndDroppedStats

import net.minecraft.item.Item; //导入方法依赖的package包/类
private static void initPickedUpAndDroppedStats()
{
    for (Item item : Item.REGISTRY)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = getItemName(item);

            if (s != null)
            {
                OBJECTS_PICKED_UP_STATS[i] = (new StatCrafting("stat.pickup.", s, new TextComponentTranslation("stat.pickup", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
                OBJECTS_DROPPED_STATS[i] = (new StatCrafting("stat.drop.", s, new TextComponentTranslation("stat.drop", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
            }
        }
    }

    replaceAllSimilarBlocks(OBJECT_BREAK_STATS);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:StatList.java

示例5: getComparatorInputOverride

import net.minecraft.item.Item; //导入方法依赖的package包/类
public int getComparatorInputOverride(World worldIn, BlockPos pos)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof BlockJukebox.TileEntityJukebox)
    {
        ItemStack itemstack = ((BlockJukebox.TileEntityJukebox)tileentity).getRecord();

        if (itemstack != null)
        {
            return Item.getIdFromItem(itemstack.getItem()) + 1 - Item.getIdFromItem(Items.record_13);
        }
    }

    return 0;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:BlockJukebox.java

示例6: initItemDepleteStats

import net.minecraft.item.Item; //导入方法依赖的package包/类
private static void initItemDepleteStats()
{
    for (Item item : Item.itemRegistry)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = func_180204_a(item);

            if (s != null && item.isDamageable())
            {
                objectBreakStats[i] = (new StatCrafting("stat.breakItem.", s, new ChatComponentTranslation("stat.breakItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat();
            }
        }
    }

    replaceAllSimilarBlocks(objectBreakStats);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:19,代码来源:StatList.java

示例7: drawSlot

import net.minecraft.item.Item; //导入方法依赖的package包/类
protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn)
{
    StatCrafting statcrafting = this.func_148211_c(entryID);
    Item item = statcrafting.func_150959_a();
    GuiStats.this.drawStatsScreen(p_180791_2_ + 40, p_180791_3_, item);
    int i = Item.getIdFromItem(item);
    this.func_148209_a(StatList.objectCraftStats[i], p_180791_2_ + 115, p_180791_3_, entryID % 2 == 0);
    this.func_148209_a(StatList.objectUseStats[i], p_180791_2_ + 165, p_180791_3_, entryID % 2 == 0);
    this.func_148209_a(statcrafting, p_180791_2_ + 215, p_180791_3_, entryID % 2 == 0);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:GuiStats.java

示例8: isThrowable

import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
 * Check if the item is a bow, snowball, egg, fishing rod, or ender pearl
 */
public static boolean isThrowable(ItemStack itemStack) {
    if(itemStack == null) return false;
    switch (Item.getIdFromItem(itemStack.getItem())) {
        case 261: // bow
        case 332: // snowball
        case 344: // egg
        case 346: // fishing rod
        case 368: // ender pearl
            return true;
        default:
            return false;
    }
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:17,代码来源:ProjectileUtils.java

示例9: initCraftableStats

import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
 * Initializes statistics related to craftable items. Is only called after both block and item stats have been
 * initialized.
 */
private static void initCraftableStats()
{
    Set<Item> set = Sets.<Item>newHashSet();

    for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList())
    {
        if (irecipe.getRecipeOutput() != null)
        {
            set.add(irecipe.getRecipeOutput().getItem());
        }
    }

    for (ItemStack itemstack : FurnaceRecipes.instance().getSmeltingList().values())
    {
        set.add(itemstack.getItem());
    }

    for (Item item : set)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = func_180204_a(item);

            if (s != null)
            {
                objectCraftStats[i] = (new StatCrafting("stat.craftItem.", s, new ChatComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat();
            }
        }
    }

    replaceAllSimilarBlocks(objectCraftStats);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:38,代码来源:StatList.java

示例10: S0CPacketSpawnPlayer

import net.minecraft.item.Item; //导入方法依赖的package包/类
public S0CPacketSpawnPlayer(EntityPlayer player)
{
    this.entityId = player.getEntityId();
    this.playerId = player.getGameProfile().getId();
    this.x = MathHelper.floor_double(player.posX * 32.0D);
    this.y = MathHelper.floor_double(player.posY * 32.0D);
    this.z = MathHelper.floor_double(player.posZ * 32.0D);
    this.yaw = (byte)((int)(player.rotationYaw * 256.0F / 360.0F));
    this.pitch = (byte)((int)(player.rotationPitch * 256.0F / 360.0F));
    ItemStack itemstack = player.inventory.getCurrentItem();
    this.currentItem = itemstack == null ? 0 : Item.getIdFromItem(itemstack.getItem());
    this.watcher = player.getDataWatcher();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:S0CPacketSpawnPlayer.java

示例11: StatCrafting

import net.minecraft.item.Item; //导入方法依赖的package包/类
public StatCrafting(String p_i45910_1_, String p_i45910_2_, IChatComponent statNameIn, Item p_i45910_4_)
{
    super(p_i45910_1_ + p_i45910_2_, statNameIn);
    this.field_150960_a = p_i45910_4_;
    int i = Item.getIdFromItem(p_i45910_4_);

    if (i != 0)
    {
        IScoreObjectiveCriteria.INSTANCES.put(p_i45910_1_ + i, this.func_150952_k());
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:12,代码来源:StatCrafting.java

示例12: getCustomItemProperties

import net.minecraft.item.Item; //导入方法依赖的package包/类
private static CustomItemProperties getCustomItemProperties(ItemStack p_getCustomItemProperties_0_, int p_getCustomItemProperties_1_)
{
    if (itemProperties == null)
    {
        return null;
    }
    else if (p_getCustomItemProperties_0_ == null)
    {
        return null;
    }
    else
    {
        Item item = p_getCustomItemProperties_0_.getItem();
        int i = Item.getIdFromItem(item);

        if (i >= 0 && i < itemProperties.length)
        {
            CustomItemProperties[] acustomitemproperties = itemProperties[i];

            if (acustomitemproperties != null)
            {
                for (int j = 0; j < acustomitemproperties.length; ++j)
                {
                    CustomItemProperties customitemproperties = acustomitemproperties[j];

                    if (customitemproperties.type == p_getCustomItemProperties_1_ && matchesProperties(customitemproperties, p_getCustomItemProperties_0_, (int[][])null))
                    {
                        return customitemproperties;
                    }
                }
            }
        }

        return null;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:37,代码来源:CustomItems.java

示例13: getDroppedObjectStats

import net.minecraft.item.Item; //导入方法依赖的package包/类
@Nullable
public static StatBase getDroppedObjectStats(Item itemIn)
{
    return OBJECTS_DROPPED_STATS[Item.getIdFromItem(itemIn)];
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:StatList.java

示例14: StatsItem

import net.minecraft.item.Item; //导入方法依赖的package包/类
public StatsItem(Minecraft mcIn)
{
    super(mcIn);
    this.statsHolder = Lists.<StatCrafting>newArrayList();

    for (StatCrafting statcrafting : StatList.itemStats)
    {
        boolean flag = false;
        int i = Item.getIdFromItem(statcrafting.func_150959_a());

        if (GuiStats.this.field_146546_t.readStat(statcrafting) > 0)
        {
            flag = true;
        }
        else if (StatList.objectBreakStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectBreakStats[i]) > 0)
        {
            flag = true;
        }
        else if (StatList.objectCraftStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[i]) > 0)
        {
            flag = true;
        }

        if (flag)
        {
            this.statsHolder.add(statcrafting);
        }
    }

    this.statSorter = new Comparator<StatCrafting>()
    {
        public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_)
        {
            int j = Item.getIdFromItem(p_compare_1_.func_150959_a());
            int k = Item.getIdFromItem(p_compare_2_.func_150959_a());
            StatBase statbase = null;
            StatBase statbase1 = null;

            if (StatsItem.this.field_148217_o == 0)
            {
                statbase = StatList.objectBreakStats[j];
                statbase1 = StatList.objectBreakStats[k];
            }
            else if (StatsItem.this.field_148217_o == 1)
            {
                statbase = StatList.objectCraftStats[j];
                statbase1 = StatList.objectCraftStats[k];
            }
            else if (StatsItem.this.field_148217_o == 2)
            {
                statbase = StatList.objectUseStats[j];
                statbase1 = StatList.objectUseStats[k];
            }

            if (statbase != null || statbase1 != null)
            {
                if (statbase == null)
                {
                    return 1;
                }

                if (statbase1 == null)
                {
                    return -1;
                }

                int l = GuiStats.this.field_146546_t.readStat(statbase);
                int i1 = GuiStats.this.field_146546_t.readStat(statbase1);

                if (l != i1)
                {
                    return (l - i1) * StatsItem.this.field_148215_p;
                }
            }

            return j - k;
        }
    };
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:80,代码来源:GuiStats.java

示例15: makePotionProperties

import net.minecraft.item.Item; //导入方法依赖的package包/类
private static Properties makePotionProperties(String p_makePotionProperties_0_, String p_makePotionProperties_1_, int p_makePotionProperties_2_, String p_makePotionProperties_3_)
{
    if (StrUtils.endsWith(p_makePotionProperties_0_, new String[] {"_n", "_s"}))
    {
        return null;
    }
    else if (p_makePotionProperties_0_.equals("empty") && p_makePotionProperties_1_.equals("normal"))
    {
        p_makePotionProperties_2_ = Item.getIdFromItem(Items.GLASS_BOTTLE);
        Properties properties = new Properties();
        properties.put("type", "item");
        properties.put("items", "" + p_makePotionProperties_2_);
        return properties;
    }
    else
    {
        int[] aint = (int[])((int[])getMapPotionIds().get(p_makePotionProperties_0_));

        if (aint == null)
        {
            Config.warn("Potion not found for image: " + p_makePotionProperties_3_);
            return null;
        }
        else
        {
            StringBuffer stringbuffer = new StringBuffer();

            for (int i = 0; i < aint.length; ++i)
            {
                int j = aint[i];

                if (p_makePotionProperties_1_.equals("splash"))
                {
                    j |= 16384;
                }

                if (i > 0)
                {
                    stringbuffer.append(" ");
                }

                stringbuffer.append(j);
            }

            int k = 16447;

            if (p_makePotionProperties_0_.equals("water") || p_makePotionProperties_0_.equals("mundane"))
            {
                k |= 64;
            }

            Properties properties1 = new Properties();
            properties1.put("type", "item");
            properties1.put("items", "" + p_makePotionProperties_2_);
            properties1.put("damage", "" + stringbuffer.toString());
            properties1.put("damageMask", "" + k);

            if (p_makePotionProperties_1_.equals("splash"))
            {
                properties1.put("texture.potion_bottle_splash", p_makePotionProperties_0_);
            }
            else
            {
                properties1.put("texture.potion_bottle_drinkable", p_makePotionProperties_0_);
            }

            return properties1;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:71,代码来源:CustomItems.java


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