LootTableManager
Link to loottablemanager
Manager for loot tables.
An instance of this manager can be obtained via the LootManager.
These methods can only be called from the server side, so ensure that all calls are inside a level.isClientSide
check or a #onlyIf side server
preprocessor!
导入类
Link to 导入类
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 crafttweaker.api.loot.table.LootTableManager;
Enum Constants
Link to enum-constants
LootTableManager is an enum. It has 1 enum constants. They are accessible using the code below.
ZenScript CopyLootTableManager.INSTANCE
使用方式
Link to 使用方式
Name: getIds
Gets the ids of all registered loot tables.
Returns: The ids of all registered loot tables.
Return Type: Set<ResourceLocation>
ZenScript Copy// LootTableManager.getIds() as Set<ResourceLocation>
loot.tables.getIds();
Name: getTable
Gets a table with the given name.
If no table is registered with the name, an empty table will be returned.
Returns: The found table or an empty table if not found.
Return Type: LootTable
ZenScript Copy// LootTableManager.getTable(name as ResourceLocation) as LootTable
loot.tables.getTable(<resource:minecraft:gameplay/cat_morning_gift>);
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 资源位置 | 描述 The name of the table to get. |
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 ids | 类型 Set<ResourceLocation> | 可获得 true | 可设置 false | 描述 Gets the ids of all registered loot tables. |