I - The type of the item (e.g. Integer)S - The type of the item stack (e.g. LegacyItemStack)public class EnchantmentRegistry<I,S extends net.lenni0451.mcstructs.items.AItemStack<I,S>>
extends java.lang.Object
| Constructor and Description |
|---|
EnchantmentRegistry() |
| Modifier and Type | Method and Description |
|---|---|
void |
addIncompatibility(Enchantment enchantment,
Enchantment incompatibility)
Add an incompatibility between two enchantments.
|
void |
addItemCompatibility(Enchantment enchantment,
java.util.function.Function<S,java.lang.Boolean> incompatibility)
Add an item compatibility function for an enchantment.
|
Enchantment |
get(int id)
Get an enchantment by its id.
|
Enchantment |
get(java.lang.String name)
Get an enchantment by its name.
|
boolean |
isIncompatible(Enchantment enchantment,
Enchantment other)
Check if two enchantments are compatible with each other.
|
boolean |
isItemCompatible(Enchantment enchantment,
S itemStack)
Check if an enchantment can be applied to an item.
|
void |
register(Enchantment enchantment)
Register a new enchantment.
|
public void register(Enchantment enchantment)
enchantment - The enchantment to register@Nullable public Enchantment get(int id)
id - The id of the enchantmentpublic Enchantment get(java.lang.String name)
name - The name of the enchantmentpublic boolean isIncompatible(Enchantment enchantment, Enchantment other)
enchantment - The first enchantmentother - The second enchantmentpublic boolean isItemCompatible(Enchantment enchantment, S itemStack)
enchantment - The enchantmentitemStack - The item stackpublic void addIncompatibility(Enchantment enchantment, Enchantment incompatibility)
enchantment - The first enchantmentincompatibility - The second enchantmentpublic void addItemCompatibility(Enchantment enchantment, java.util.function.Function<S,java.lang.Boolean> incompatibility)
enchantment - The enchantmentincompatibility - The item compatibility