ModuleHelper
Link to modulehelper
This class was added by a mod with mod-id mekanism
. So you need to have this mod installed if you
want to use this feature.
Importing the class
Link to importing-the-class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport mods.mekanism.api.gear.ModuleHelper;
Static Methods
Link to static-methods
Name: getSupported
Gets all the module types a given item support.
Returns: Set of supported module types.
Return Type: Set<ModuleData>
ZenScript CopyModuleHelper.getSupported(container as ItemStack) as Set<ModuleData>
Parameter | Type | Description |
---|---|---|
Parameter container | Type ItemStack | Description Module container, for example a Meka-Tool or MekaSuit piece. |
Name: getSupported
Helper to get the various items that support a given module type.
Returns: Set of items that support the given module type.
Return Type: Set<MCItemDefinition>
ZenScript CopyModuleHelper.getSupported(type as ModuleData) as Set<MCItemDefinition>
Parameter | Type | Description |
---|---|---|
Parameter type | Type ModuleData | Description Module type. |
Name: isEnabled
Helper method to check if an item has a module installed and the module is enabled.
Returns: true
if the item has the module installed and enabled.
Return Type: boolean
ZenScript CopyModuleHelper.isEnabled(container as ItemStack, type as ModuleData) as boolean
Parameter | Type | Description |
---|---|---|
Parameter container | Type ItemStack | Description Module container, for example a Meka-Tool or MekaSuit piece. |
Parameter type | Type ModuleData | Description Module type. |
Name: load
Helper method to try and load a module from an item.
Returns: Module, or null
if no module of the given type is installed.
Return Type: Module<MODULE>?
ZenScript CopyModuleHelper.load<MODULE>(container as ItemStack, type as ModuleData<MODULE>) as Module<MODULE>?
Parameter | Type | Description |
---|---|---|
Parameter container | Type ItemStack | Description Module container, for example a Meka-Tool or MekaSuit piece. |
Parameter type | Type ModuleData<MODULE> | Description Module type. |
Parameter MODULE | Type | Description No Description Provided |
Name: loadAll
Gets a list of all modules on an item stack.
Returns: List of modules on an item, or an empty list if the item doesn't support modules.
Return Type: stdlib.List<Module>
ZenScript CopyModuleHelper.loadAll(container as ItemStack) as stdlib.List<Module>
Parameter | Type | Description |
---|---|---|
Parameter container | Type ItemStack | Description Module container, for example a Meka-Tool or MekaSuit piece. |
Name: loadAllTypes
Gets all the module types on an item stack.
Returns: Module types on an item.
Return Type: Collection<ModuleData>
ZenScript CopyModuleHelper.loadAllTypes(container as ItemStack) as Collection<ModuleData>
Parameter | Type | Description |
---|---|---|
Parameter container | Type ItemStack | Description Module container, for example a Meka-Tool or MekaSuit piece. |