Package wtf.choco.veinminer.tool
Class VeinMinerToolCategory
java.lang.Object
wtf.choco.veinminer.tool.VeinMinerToolCategory
- All Implemented Interfaces:
Comparable<VeinMinerToolCategory>
- Direct Known Subclasses:
VeinMinerToolCategoryHand
Represents a category of tools.
-
Constructor Summary
ConstructorDescriptionVeinMinerToolCategory
(@NotNull String id, int priority, @Nullable String nbtValue, @NotNull BlockList blockList, @NotNull VeinMiningConfig config, @NotNull Set<ItemType> items) Construct a newVeinMinerToolCategory
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Add an item to this category.int
compareTo
(VeinMinerToolCategory other) boolean
containsItem
(@NotNull ItemType item) Check whether or not this category contains the given item.boolean
@NotNull BlockList
Get theBlockList
for this tool category.@NotNull VeinMiningConfig
Get theVeinMiningConfig
for this tool category.@NotNull String
getId()
Get the unique id of this tool category.getItems()
Get an unmodifiable collection of all items in this category.@Nullable String
Get the value that must be on items in this category to be vein mineable.int
Get the priority of this tool category.int
hashCode()
boolean
removeItem
(@NotNull ItemType itemType) Remove an item from this category.toString()
-
Constructor Details
-
VeinMinerToolCategory
public VeinMinerToolCategory(@NotNull @NotNull String id, int priority, @Nullable @Nullable String nbtValue, @NotNull @NotNull BlockList blockList, @NotNull @NotNull VeinMiningConfig config, @NotNull @NotNull Set<ItemType> items) Construct a newVeinMinerToolCategory
.- Parameters:
id
- the unique id of the tool categorypriority
- the category's prioritynbtValue
- the required value of the NBT keyblockList
- the category block listconfig
- the category configitems
- the items in this category
-
-
Method Details
-
getId
Get the unique id of this tool category.- Returns:
- the category id
-
getPriority
public int getPriority()Get the priority of this tool category.Priority determines whether or not one category will be selected over another under the circumstance that more than one category matches any given item type. For instance, if two categories declare that a
diamond_pickaxe
is on the list of items, the category with the higher priority should be selected for use. Higher integers are more important than categories with lower integers. Categories with the same priority will not abide by any defined behaviour.- Returns:
- the priority
-
getNBTValue
Get the value that must be on items in this category to be vein mineable.Callers of
containsItem(ItemType)
should verify also that any ItemStack to be checked contains also the value returned by this method.- Returns:
- the NBT value, or null if no NBT is required
-
getBlockList
Get theBlockList
for this tool category.- Returns:
- the block list
-
getConfig
Get theVeinMiningConfig
for this tool category.- Returns:
- the config
-
addItem
Add an item to this category.- Parameters:
itemType
- the item type to add- Returns:
- true if the item list was modified, false if the item was already added
-
removeItem
Remove an item from this category.- Parameters:
itemType
- the item type to remove- Returns:
- true if the item list was modified, false if the item had not been added
-
containsItem
Check whether or not this category contains the given item.- Parameters:
item
- the item to check- Returns:
- true if this category contains the item, false otherwise
- API Note:
- this method only verifies that the type is contained in this category, not whether
or not an item stack contains the required NBT. For this, callers should also check that
the value of
getNBTValue()
is present in addition to the result of this method.
-
getItems
Get an unmodifiable collection of all items in this category.- Returns:
- the items
-
compareTo
Default behaviour is to compare against a category's priority (
getPriority()
).- Specified by:
compareTo
in interfaceComparable<VeinMinerToolCategory>
-
hashCode
public int hashCode() -
equals
-
toString
-