Home Commands Examples Getting Started With Scripts Global Keywords

Mods

Holds information on all the mods that are registered. Can be accessed using the loadedMods global keyword

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.

script.zs
import crafttweaker.api.mod.Mods;

Methods

Gets a specific mod

Returns: a specific Mod
Return Type: Mod?

script.zs
// Mods.getMod(modid as string) as Mod?
loadedMods.getMod("minecraft");
ParameterType
Parameter
modid
Type
string

Gets a list of all mods in the game

Returns: list of Mod
Return Type: stdlib.List<Mod>

script.zs
// Mods.getMods() as stdlib.List<Mod>
loadedMods.getMods();

Gets the amount of mods loaded

Returns: The amount of mods that are loaded
Return Type: int

script.zs
// Mods.getSize() as int
loadedMods.getSize();

Checks if a mod is laoded

Returns: true if the mod is loaded
Return Type: boolean

script.zs
// Mods.isModLoaded(modid as string) as boolean
loadedMods.isModLoaded("minecraft");
ParameterTypeDescription
Parameter
modid
Type
string
Description
modid to check

Operators

script.zs
[myMods]

Gets a specific mod

script.zs
myMods.modid as string
loadedMods."minecraft"

Properties

NameTypeHas GetterHas SetterDescription
Name
mods
Type
stdlib.List<Mod>
Has Getter
true
Has Setter
false
Description
Gets a list of all mods in the game
Name
size
Type
int
Has Getter
true
Has Setter
false
Description
Gets the amount of mods loaded