Class NotHolderSet<T>
java.lang.Object
net.minecraftforge.registries.holdersets.NotHolderSet<T>
- All Implemented Interfaces:
Iterable<Holder<T>>
,HolderSet<T>
,IForgeHolderSet<T>
,ICustomHolderSet<T>
Holderset that represents all elements of a registry not present in another holderset. forge:exclusion is preferable when the number of allowed elements is small relative to the size of the registry. Json format:
{ "type": "forge:not", "value": "not_this_holderset" // string, list, or object }
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.core.HolderSet
HolderSet.Direct<T>, HolderSet.ListBacked<T>, HolderSet.Named<T>
Nested classes/interfaces inherited from interface net.minecraftforge.common.extensions.IForgeHolderSet
IForgeHolderSet.SerializationType
-
Field Summary
-
Constructor Summary
ConstructorDescriptionNotHolderSet
(HolderLookup.RegistryLookup<T> registryLookup, HolderSet<T> value) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addInvalidationListener
(Runnable runnable) Adds a callback to run when this holderset's contents invalidate (i.e.boolean
canSerializeIn
(HolderOwner<T> holderOwner) static <T> com.mojang.serialization.MapCodec
<? extends ICustomHolderSet<T>> codec
(ResourceKey<? extends Registry<T>> registryKey, com.mojang.serialization.Codec<Holder<T>> holderCodec, boolean forceList) boolean
get
(int i) getList()
getRandomElement
(RandomSource random) private void
iterator()
int
size()
stream()
toString()
type()
Returns HolderSetType registered toinvalid reference
ForgeRegistries.HOLDER_SET_TYPES
unwrap()
value()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraftforge.registries.holdersets.ICustomHolderSet
serializationType
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
owners
-
registryLookup
-
value
-
list
-
-
Constructor Details
-
NotHolderSet
-
-
Method Details
-
codec
public static <T> com.mojang.serialization.MapCodec<? extends ICustomHolderSet<T>> codec(ResourceKey<? extends Registry<T>> registryKey, com.mojang.serialization.Codec<Holder<T>> holderCodec, boolean forceList) -
registryLookup
-
value
-
type
Description copied from interface:ICustomHolderSet
Returns HolderSetType registered toinvalid reference
ForgeRegistries.HOLDER_SET_TYPES
- Specified by:
type
in interfaceICustomHolderSet<T>
- Returns:
- HolderSetType registered to
invalid reference
ForgeRegistries.HOLDER_SET_TYPES
-
addInvalidationListener
Description copied from interface:IForgeHolderSet
Adds a callback to run when this holderset's contents invalidate (i.e. because tags were rebound).
The intended usage and use case is with composite holdersets that need to cache sets/list based on other holdersets, which may be mutable (because they are tag-based or themselves composite holdersets). Composite holdersets should use this to add callbacks to each of their component holdersets when constructed.
- Specified by:
addInvalidationListener
in interfaceIForgeHolderSet<T>
- Parameters:
runnable
- Runnable to invoke when this component holderset's contents are no longer valid. This runnable should only clear caches and allow them to be lazily reevaluated later, as not all tag holdersets may have been rebound when this is called. This runnable should also invalidate all of the caller's listeners.
-
iterator
-
stream
-
size
public int size() -
unwrap
-
getRandomElement
- Specified by:
getRandomElement
in interfaceHolderSet<T>
-
get
-
contains
-
canSerializeIn
- Specified by:
canSerializeIn
in interfaceHolderSet<T>
-
unwrapKey
-
toString
-
getList
-
invalidate
private void invalidate()
-