本文整理汇总了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());
}
}
}