Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

Mods

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

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

Description

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

Operators

.(modid as string) as Mod
Gets a specific mod
script.zs
// Mods.(modid as string) as Mod
loadedMods.myString

Parameters:

modid Type: string

Return Type: Mod

[](modid as string) as Mod
script.zs
// Mods[modid as string] as Mod
loadedMods[myString]

Parameters:

modid Type: string

Return Type: Mod

Members

getMod(modid as string) as Mod
Gets a specific mod

Returns: a specific Mod

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

Parameters:

modid Type: string

Return Type: Mod

isModLoaded(modid as string) as bool
Checks if a mod is laoded

Returns: true if the mod is loaded

script.zs
// Mods.isModLoaded(modid as string) as bool;
loadedMods.isModLoaded("minecraft");

Parameters:

modid Type: string - modid to check

Return Type: bool

Getter
Gets a list of all mods in the game
script.zs
// Mods.mods as List<Mod>
loadedMods.mods

Return Type: List<Mod>

mods() as List<Mod>
Gets a list of all mods in the game

Returns: list of Mod

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

Return Type: List<Mod>

Getter
Gets the amount of mods loaded
script.zs
// Mods.size as int
loadedMods.size

Return Type: int

size() as int
Gets the amount of mods loaded

Returns: The amount of mods that are loaded

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

Return Type: int