use of mekanism.api.gear.ICustomModule in project Mekanism by mekanism.
the class ModuleHelper method loadAll.
@Override
public <MODULE extends ICustomModule<?>> List<Module<? extends MODULE>> loadAll(ItemStack container, Class<MODULE> moduleClass) {
if (container.getItem() instanceof IModuleContainerItem) {
List<Module<? extends MODULE>> modules = new ArrayList<>();
CompoundNBT modulesTag = ItemDataUtils.getCompound(container, NBTConstants.MODULES);
for (ModuleData<?> moduleType : loadAllTypes(modulesTag)) {
Module<?> module = load(container, moduleType, modulesTag, moduleClass);
if (module != null) {
modules.add((Module<? extends MODULE>) module);
}
}
return modules;
}
return Collections.emptyList();
}
Aggregations