Class LootTableManager
java.lang.Object
net.minestom.server.gamedata.loottables.LootTableManager
public final class LootTableManager
extends java.lang.Object
Handles loading and configuration of loot tables
-
Constructor Summary
Constructors Constructor Description LootTableManager()
-
Method Summary
Modifier and Type Method Description com.google.gson.JsonDeserializer<? extends Condition>
getConditionDeserializer(NamespaceID id)
LootTableEntryType
getEntryType(NamespaceID id)
Returns the registered entry type corresponding to the given namespace ID.LootTableFunction
getFunction(NamespaceID id)
Returns the registered table type corresponding to the given namespace ID.LootTableType
getTableType(NamespaceID id)
Returns the registered table type corresponding to the given namespace ID.LootTable
load(NamespaceID name)
LootTable
load(NamespaceID name, java.io.Reader reader)
Loads a loot table with the given name.<T extends Condition>
voidregisterConditionDeserializer(NamespaceID namespaceID, com.google.gson.JsonDeserializer<T> factory)
Registers a condition factory to the given namespaceIDvoid
registerEntryType(NamespaceID namespaceID, LootTableEntryType type)
Registers a loot table entry type to the given namespaceIDvoid
registerFunction(NamespaceID namespaceID, LootTableFunction function)
Registers a loot table function to the given namespaceIDvoid
registerTableType(NamespaceID namespaceID, LootTableType type)
Registers a loot table type to the given namespaceID
-
Constructor Details
-
LootTableManager
public LootTableManager()
-
-
Method Details
-
registerConditionDeserializer
public <T extends Condition> void registerConditionDeserializer(NamespaceID namespaceID, com.google.gson.JsonDeserializer<T> factory)Registers a condition factory to the given namespaceID- Parameters:
namespaceID
-factory
-
-
registerTableType
Registers a loot table type to the given namespaceID- Parameters:
namespaceID
-type
-
-
registerEntryType
Registers a loot table entry type to the given namespaceID- Parameters:
namespaceID
-type
-
-
registerFunction
Registers a loot table function to the given namespaceID- Parameters:
namespaceID
-function
-
-
load
- Throws:
java.io.FileNotFoundException
-
load
Loads a loot table with the given name. Loot tables can be cached, so 'reader' is used only on cache misses- Parameters:
name
- the name to cache the loot table withreader
- the reader to read the loot table from, if none cached. **Will** be closed no matter the results of this call- Returns:
-
getTableType
Returns the registered table type corresponding to the given namespace ID. If none is registered, throwsIllegalArgumentException
- Parameters:
id
-- Returns:
-
getEntryType
Returns the registered entry type corresponding to the given namespace ID. If none is registered, throwsIllegalArgumentException
- Parameters:
id
-- Returns:
-
getFunction
Returns the registered table type corresponding to the given namespace ID. If none is registered, returnsLootTableFunction.IDENTITY
- Parameters:
id
-- Returns:
-
getConditionDeserializer
public com.google.gson.JsonDeserializer<? extends Condition> getConditionDeserializer(NamespaceID id)
-