當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。