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


Java Item.REGISTRY属性代码示例

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


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

示例1: getSearchEntries

/**
 * Lazy cache.
 * @return
 */
private Stream<SearchEntry> getSearchEntries(){
    if(cachedSearchEntries == null){
        NonNullList<ItemStack> itemList = NonNullList.create();

        for(Item item : Item.REGISTRY){
            if (item != null && item.getCreativeTab() != null) {
                item.getSubItems(item.getCreativeTab(), itemList);
            }
        }

        for (Enchantment enchantment : Enchantment.REGISTRY) {
            if (enchantment != null && enchantment.type != null) {
                getAllEnchantedBooks(enchantment, itemList);
            }
        }

        cachedSearchEntries = itemList.stream().map(SearchEntry::new).collect(Collectors.toList());
    }
    return cachedSearchEntries.stream();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:24,代码来源:GuiSearcher.java

示例2: initStats

private static void initStats()
{
    for (Item item : Item.REGISTRY)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = getItemName(item);

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

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

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

示例3: initItemDepleteStats

private static void initItemDepleteStats()
{
    for (Item item : Item.REGISTRY)
    {
        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);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:StatList.java

示例4: initPickedUpAndDroppedStats

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,代码行数:19,代码来源:StatList.java

示例5: displayAllRelevantItems

/**
 * only shows items which have tabToDisplayOn == this
 */
public void displayAllRelevantItems(NonNullList<ItemStack> p_78018_1_)
{
    for (Item item : Item.REGISTRY)
    {
        if (item != null && item.getCreativeTab() == this)
        {
            item.getSubItems(item, this, p_78018_1_);
        }
    }

    if (this.getRelevantEnchantmentTypes() != null)
    {
        this.addEnchantmentBooksToList(p_78018_1_, this.getRelevantEnchantmentTypes());
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:CreativeTabs.java

示例6: updateCreativeSearch

private void updateCreativeSearch()
{
    GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
    guicontainercreative$containercreative.itemList.clear();

    CreativeTabs tab = CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex];
    if (tab.hasSearchBar() && tab != CreativeTabs.SEARCH)
    {
        tab.displayAllRelevantItems(guicontainercreative$containercreative.itemList);
        updateFilteredItems(guicontainercreative$containercreative);
        return;
    }

    for (Item item : Item.REGISTRY)
    {
        if (item != null && item.getCreativeTab() != null)
        {
            item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
        }
    }
    updateFilteredItems(guicontainercreative$containercreative);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:GuiContainerCreative.java

示例7: displayAllRelevantItems

/**
 * only shows items which have tabToDisplayOn == this
 */
@SideOnly(Side.CLIENT)
public void displayAllRelevantItems(List<ItemStack> p_78018_1_)
{
    for (Item item : Item.REGISTRY)
    {
        if (item == null)
        {
            continue;
        }
        for (CreativeTabs tab : item.getCreativeTabs())
        {
            if (tab == this)
            {
                item.getSubItems(item, this, p_78018_1_);
            }
        }
    }

    if (this.getRelevantEnchantmentTypes() != null)
    {
        this.addEnchantmentBooksToList(p_78018_1_, this.getRelevantEnchantmentTypes());
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:CreativeTabs.java

示例8: generateDawnstoneAnvilRecipes

private List<RecipeDawnstoneAnvil> generateDawnstoneAnvilRecipes()
{
    //I'm basicly sorry for all of this. Please forgive me.
    ArrayList<RecipeDawnstoneAnvil> repairRecipes = new ArrayList<>();
    ArrayList<RecipeDawnstoneAnvil> destroyRecipes = new ArrayList<>();

    for (Item item : Item.REGISTRY) {
        ItemStack stack = item.getDefaultInstance();
        ItemStack repairItem = ItemStack.EMPTY;
        try {
            repairItem = Misc.getRepairItem(stack);
        }
        catch (Exception e) { //Gotta catch em all
            e.printStackTrace();
        }
        boolean isRepairable = item.getIsRepairable(stack, repairItem);
        boolean materiaAllowed = item.isRepairable();
        if(isRepairable || materiaAllowed)
        {
            ArrayList<ItemStack> repairMaterials = new ArrayList<>();
            repairMaterials.add(repairItem.copy());
            if(materiaAllowed)
                repairMaterials.add(new ItemStack(RegistryManager.isolated_materia));
            ItemStack[] repairMaterialsArray = repairMaterials.toArray(new ItemStack[repairMaterials.size()]);
            repairRecipes.add(new RecipeDawnstoneAnvil(new ItemStack[]{stack.copy()}, Ingredient.fromStacks(makeDamaged(stack)),Ingredient.fromStacks(repairMaterialsArray)));
            if(Misc.getResourceCount(stack) != -1) {
                ItemStack material = repairItem.copy();
                material.setCount(Misc.getResourceCount(stack));
                destroyRecipes.add(new RecipeDawnstoneAnvil(new ItemStack[]{material}, Ingredient.fromStacks(makeDamaged(stack)), Ingredient.EMPTY));
            }
        }
    }

    return Stream.concat(repairRecipes.stream(),destroyRecipes.stream()).collect(Collectors.toList());
}
 
开发者ID:DaedalusGame,项目名称:Soot,代码行数:35,代码来源:JEI.java

示例9: registerModels

/**
 * Register all Item and Block models from the registry.
 */
public static void registerModels() {
	for (Block block : Block.REGISTRY) {
		if (block instanceof IModelRegister)
			((IModelRegister) block).registerModel();
	}

	for (Item item : Item.REGISTRY) {
		if (item instanceof IModelRegister)
			((IModelRegister) item).registerModel();
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:14,代码来源:ModelHandler.java

示例10: registerModels

public static void registerModels() {
	for(Block block : Block.REGISTRY) {
		if(block instanceof IModel)
			((IModel) block).registerModel();
	}

	for(Item item : Item.REGISTRY) {
		if(item instanceof IModel)
			((IModel) item).registerModel();
	}
	Solar.LOG.info("[BAKING CHOCOLATE COOKIES!]");
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:12,代码来源:ModelHandler.java

示例11: postInit

public static void postInit()
{
	for(Item item : Item.REGISTRY)
	{
		if(item instanceof ItemAnimaShield)
		{
			shieldItems.add((ItemAnimaShield) item);
		}
	}
}
 
开发者ID:Lemonszz,项目名称:Anima-Mundi,代码行数:10,代码来源:AnimaItems.java

示例12: loadItemModels

private void loadItemModels()
{
    this.registerVariantNames();

    for (Item item : Item.REGISTRY)
    {
        for (String s : this.getVariantNames(item))
        {
            ResourceLocation resourcelocation = this.getItemLocation(s);
            ResourceLocation resourcelocation1 = (ResourceLocation)Item.REGISTRY.getNameForObject(item);
            this.loadItemModel(s, resourcelocation, resourcelocation1);

            if (item.hasCustomProperties())
            {
                ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation);

                if (modelblock != null)
                {
                    for (ResourceLocation resourcelocation2 : modelblock.getOverrideLocations())
                    {
                        this.loadItemModel(resourcelocation2.toString(), resourcelocation2, resourcelocation1);
                    }
                }
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:ModelBakery.java

示例13: loadItemModels

protected void loadItemModels()
{
    this.registerVariantNames();

    for (Item item : Item.REGISTRY)
    {
        for (String s : this.getVariantNames(item))
        {
            ResourceLocation resourcelocation = this.getItemLocation(s);
            ResourceLocation resourcelocation1 = (ResourceLocation)Item.REGISTRY.getNameForObject(item);
            this.loadItemModel(s, resourcelocation, resourcelocation1);

            if (item.hasCustomProperties())
            {
                ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation);

                if (modelblock != null)
                {
                    for (ResourceLocation resourcelocation2 : modelblock.getOverrideLocations())
                    {
                        this.loadItemModel(resourcelocation2.toString(), resourcelocation2, resourcelocation1);
                    }
                }
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:ModelBakery.java

示例14: updateCreativeSearch

private void updateCreativeSearch()
{
    GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
    guicontainercreative$containercreative.itemList.clear();

    for (Item item : Item.REGISTRY)
    {
        if (item != null && item.getCreativeTab() != null)
        {
            item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
        }
    }

    for (Enchantment enchantment : Enchantment.REGISTRY)
    {
        if (enchantment != null && enchantment.type != null)
        {
            Items.ENCHANTED_BOOK.getAll(enchantment, guicontainercreative$containercreative.itemList);
        }
    }

    Iterator<ItemStack> iterator = guicontainercreative$containercreative.itemList.iterator();
    String s1 = this.searchField.getText().toLowerCase(Locale.ROOT);

    while (iterator.hasNext())
    {
        ItemStack itemstack = (ItemStack)iterator.next();
        boolean flag = false;

        for (String s : itemstack.getTooltip(this.mc.player, this.mc.gameSettings.advancedItemTooltips))
        {
            if (TextFormatting.getTextWithoutFormattingCodes(s).toLowerCase(Locale.ROOT).contains(s1))
            {
                flag = true;
                break;
            }
        }

        if (!flag)
        {
            iterator.remove();
        }
    }

    this.currentScroll = 0.0F;
    guicontainercreative$containercreative.scrollTo(0.0F);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:47,代码来源:GuiContainerCreative.java


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