Interface ItemRegistry
public interface ItemRegistry
Where items are declared: the vanilla ones, and the ones plugins invent.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault ItemStackCreates a stack of one.Creates a stack, pre-filled with the definition's components for a declared item.definition(Key itemType) booleanbooleannetworkType(Key itemType) Resolves the vanilla item the client is sent for a key.voidregister(ItemDefinition definition, Plugin owner) Declares an item of its own.types()booleanunregister(Key itemType) Drops a definition declared throughregister(ItemDefinition, Plugin).voidunregisterAll(Plugin owner) Drops every definition a plugin declared.
-
Method Details
-
register
Declares an item of its own.- Parameters:
definition- the item to declareowner- the plugin declaring it- Throws:
IllegalArgumentException- ifItemDefinition.networkType()is not a known item, or if the key shadows a vanilla item- Since:
- 0.1.0
-
unregister
Drops a definition declared throughregister(ItemDefinition, Plugin).- Parameters:
itemType- the key to drop- Returns:
trueif a definition was registered under that key- Since:
- 0.1.0
-
unregisterAll
Drops every definition a plugin declared.- Parameters:
owner- the plugin to clean up after- Since:
- 0.1.0
-
definition
- Parameters:
itemType- the key to look up- Returns:
- the definition registered under that key, empty for a vanilla item
- Since:
- 0.1.0
-
definitions
Collection<ItemDefinition> definitions()- Returns:
- every definition registered by a plugin
- Since:
- 0.1.0
-
types
-
isItem
- Parameters:
itemType- the key to test- Returns:
truewhen a stack can be created under that key- Since:
- 0.1.0
-
isCustom
- Parameters:
itemType- the key to test- Returns:
truewhen a plugin declared this key- Since:
- 0.1.0
-
networkType
Resolves the vanilla item the client is sent for a key.- Parameters:
itemType- the key to resolve- Returns:
- the declared
ItemDefinition.networkType(), or the key itself when vanilla - Since:
- 0.1.0
-
create
Creates a stack of one.- Parameters:
itemType- the item to create- Returns:
- the stack,
ItemStack.EMPTYwhen the key is unknown - Since:
- 0.1.0
-
create
Creates a stack, pre-filled with the definition's components for a declared item.- Parameters:
itemType- the item to createcount- how many- Returns:
- the stack,
ItemStack.EMPTYwhen the key is unknown - Since:
- 0.1.0
-