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