Mods

保存所有注册模组的信息。 可以使用 加载模组 全局关键字 访问

导入相关包

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
Copy
import crafttweaker.api.mods.Mods;

方法

getMod

Gets a specific mod

Returns: a specific MCModInfo
Return Type: ModInfo

ZenScript
Copy
// Mods.getMod(modid as string) as ModInfo

loadedMods.getMod("minecraft");
参数类型描述
modidstringNo Description Provided
isModLoaded

Checks if a mod is laoded

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

ZenScript
Copy
// Mods.isModLoaded(modid as string) as boolean

loadedMods.isModLoaded("minecraft");
参数类型描述
modidstring摩托车检查

参数

名称类型可获得可设置描述
模组stdlib.List<ModInfo>truefalseGets a list of all mods in the game
sizeinttruefalseGets the amount of mods loaded