Package alexiil.mc.lib.attributes
Class CompatLeveledMap<Instance,Cls,V>
java.lang.Object
alexiil.mc.lib.attributes.CompatLeveledMap<Instance,Cls,V>
- Type Parameters:
Instance
- The object to map directly against with equals - for example this might beBlock
, orItem
, orBlockEntityType
, orEntityType
.Cls
- The class to map directly or hierarchically against - for example this might beBlock
, orItem
, orBlockEntity
, orEntity
.
public final class CompatLeveledMap<Instance,Cls,V>
extends java.lang.Object
Used primarily by
Attribute
to manage the custom adder list, and FluidContainerRegistry
to manage
filters for fluids.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CompatLeveledMap.ValueEntry<V>
-
Field Summary
Fields Modifier and Type Field Description int
baseOffset
static int
NULL_PRIORITY
int
priorityMultiplier
-
Constructor Summary
Constructors Constructor Description CompatLeveledMap(java.lang.String name, java.lang.Class<Cls> usedClass, V nullValue, java.util.function.Function<Instance,java.lang.String> toStringFunc)
-
Method Summary
Modifier and Type Method Description void
addPredicateBased(AttributeSourceType type, boolean specific, java.util.function.Predicate<? super Instance> predicate, V value)
V
get(Instance key, java.lang.Class<? extends Cls> clazz)
CompatLeveledMap.ValueEntry<V>
getEntry(Instance key, java.lang.Class<? extends Cls> clazz)
void
putClassBased(AttributeSourceType type, java.lang.Class<?> clazz, boolean matchSubclasses, V value)
void
putExact(AttributeSourceType type, Instance key, V value)
-
Field Details
-
NULL_PRIORITY
public static final int NULL_PRIORITY- See Also:
- Constant Field Values
-
baseOffset
public int baseOffset -
priorityMultiplier
public int priorityMultiplier
-
-
Constructor Details
-
CompatLeveledMap
public CompatLeveledMap(java.lang.String name, java.lang.Class<Cls> usedClass, V nullValue, java.util.function.Function<Instance,java.lang.String> toStringFunc)- Parameters:
nullValue
- A non-null value to use to indicate that this doesn't contain any entries for the given key. Note that this value will not be returned unless it is added to this map separately with any of the "put" methods.
-
-
Method Details
-
get
-
getEntry
-
putExact
-
addPredicateBased
public void addPredicateBased(AttributeSourceType type, boolean specific, java.util.function.Predicate<? super Instance> predicate, V value) -
putClassBased
public void putClassBased(AttributeSourceType type, java.lang.Class<?> clazz, boolean matchSubclasses, V value)
-