You can use the global keyword loadedMods to access all currently loaded mods.
If needed you can import the class using import crafttweaker.mods.ILoadedMods;

检查一个模组是否被加载

Link to 检查一个模组是否被加载

Use the in function to check if a mod is loaded;
You can also use the contains method:

ZenScript
Copy
//if MinecraftCoderPack is loaded
if(loadedMods in "mcp"){
    print("success!");
}

//if MinecraftCoderPack is loaded
if(loadedMods.contains("mcp")){
    print("success!!!");
}

Retrieve a specific mod

Link to retrieve-a-specific-mod

You can retrieve a specific mod as IMod as long as you have it's ID

ZenScript
Copy
//retrieves the minecraftCoderPack mod
val mod = loadedMods["mcp"];

Iterate through the modList

Link to iterate-through-the-modlist

You can iterate through the list of loaded mods like this:

ZenScript
Copy
//prints all registred item definitions, not recommended in larger packs!
//the mod variable will be an IMod type
for mod in loadedMods {
    print(mod.name ~ ":");
    for item in mod.items {
        print("\t\t" ~ item.displayName);
    }
}

The IMod Interface provides you with some general information on a specific mod.
If needed, it can be imported using import crafttweaker.mods.IMod;

Zengetter功能返回值类型Usage
Zengetter
id
功能
Returns the mod's id
返回值类型
string
Usage
mod.id
Zengetter
name(名称)
功能
Returns the mod's internal name
返回值类型
string
Usage
mod.name
Zengetter
version
功能
Returns the mod's version
返回值类型
string
Usage
mod.version
Zengetter
description
功能
Returns the mod description
返回值类型
string
Usage
mod.description
Zengetter
items
功能
Returns all items added by the mod
返回值类型
IItemStack[]
Usage
mod.items