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


Java ForgeRegistries.ITEMS属性代码示例

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


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

示例1: initialize

public static void initialize() {
    NonNullList<ItemStack> stacks = NonNullList.create();
    for (Item i : ForgeRegistries.ITEMS) {
        CreativeTabs tab = i.getCreativeTab();
        if(tab != null) {
            i.getSubItems(tab, stacks);
        }
    }
    List<ItemStack> out = new LinkedList<>();
    for (ItemStack stack : stacks) {
        int burn = TileEntityFurnace.getItemBurnTime(stack); //Respects vanilla values.
        if(burn > 0) {
            out.add(stack);
        }
    }
    knownFuelStacks = ImmutableList.copyOf(out);
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:17,代码来源:FuelItemHelper.java

示例2: createAllowedValues

private static List<ItemStack> createAllowedValues(boolean allowSubItems,
		Predicate<ItemStack> allowItemStackPredicate) {
	List<ItemStack> values = Lists.newArrayList();
	for (Item item : ForgeRegistries.ITEMS) {
		if (allowSubItems) {
			NonNullList<ItemStack> subItems = NonNullList.create();
			item.getSubItems(item, null, subItems);
			for (ItemStack subItem : subItems) {
				if (allowItemStackPredicate.apply(subItem)) {
					values.add(subItem);
				}
			}
		} else {
			ItemStack stackToAdd = new ItemStack(item);
			if (allowItemStackPredicate.apply(stackToAdd)) {
				values.add(stackToAdd);
			}
		}
	}
	return values;
}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:21,代码来源:GuiSelectItem.java

示例3: findAllFoodItems

private NonNullList<Item> findAllFoodItems()
{
	NonNullList<Item> lst = NonNullList.create();

	for (Item item : ForgeRegistries.ITEMS)
	{
		if (item instanceof ItemFood)
		{
			lst.add(item);
		}
	}

	return lst;
}
 
开发者ID:DarkMorford,项目名称:BetterThanWeagles,代码行数:14,代码来源:FoodIngredient.java

示例4: modPreinitialization

@Subscribe
public void modPreinitialization(FMLPreInitializationEvent evt)
{
    // Initialize all Forge/Vanilla registries {invoke the static init)
    if (ForgeRegistries.ITEMS == null)
        throw new RuntimeException("Something horrible went wrong in init, ForgeRegistres didn't create...");
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:FMLContainer.java

示例5: loadModSubsets

private static void loadModSubsets() {
    ProgressBar bar = ProgressManager.push("Mod Subsets", ForgeRegistries.ITEMS.getKeys().size());
    HashMap<String, ItemStackSet> modSubsets = new HashMap<>();

    for (Item item : ForgeRegistries.ITEMS) {
        ResourceLocation ident = item.getRegistryName();
        bar.step(ident.toString());
        if (ident == null) {
            LogHelper.error("Failed to find identifier for: " + item);
            continue;
        }
        String modId = ident.getResourceDomain();
        ItemInfo.itemOwners.put(item, modId);
        ItemStackSet itemset = modSubsets.computeIfAbsent(modId, k -> new ItemStackSet());
        itemset.with(item);
    }
    ProgressManager.pop(bar);

    API.addSubset("Mod.Minecraft", modSubsets.remove("minecraft"));
    for (Entry<String, ItemStackSet> entry : modSubsets.entrySet()) {
        ModContainer mc = FMLCommonHandler.instance().findContainerFor(entry.getKey());
        if (mc == null) {
            LogHelper.error("Missing container for " + entry.getKey());
        } else {
            API.addSubset("Mod." + mc.getName(), entry.getValue());
        }
    }
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:28,代码来源:NEIInitialization.java


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