本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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...");
}
示例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());
}
}
}