Class NotHolderSet<T>
java.lang.Object
net.neoforged.neoforge.registries.holdersets.NotHolderSet<T>
- All Implemented Interfaces:
Iterable<net.minecraft.core.Holder<T>>
,net.minecraft.core.HolderSet<T>
,IHolderSetExtension<T>
,ICustomHolderSet<T>
Holderset that represents all elements of a registry not present in another holderset. neoforge:exclusion is preferable when the number of allowed elements is small relative to the size of the registry. Json format:
{ "type": "neoforge:not", "value": "not_this_holderset" // string, list, or object }
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface net.minecraft.core.HolderSet
net.minecraft.core.HolderSet.Direct<T>, net.minecraft.core.HolderSet.ListBacked<T>, net.minecraft.core.HolderSet.Named<T>
Nested classes/interfaces inherited from interface net.neoforged.neoforge.common.extensions.IHolderSetExtension
IHolderSetExtension.SerializationType
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNotHolderSet
(net.minecraft.core.HolderLookup.RegistryLookup<T> registryLookup, net.minecraft.core.HolderSet<T> value) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addInvalidationListener
(Runnable runnable) Adds a callback to run when this holderset's contents invalidate (i.e. because tags were rebound).boolean
canSerializeIn
(net.minecraft.core.HolderOwner<T> holderOwner) boolean
net.minecraft.core.Holder
<T> get
(int i) getList()
getRandomElement
(net.minecraft.util.RandomSource random) private void
boolean
isBound()
iterator()
net.minecraft.core.HolderLookup.RegistryLookup
<T> int
size()
stream()
toString()
type()
Returns HolderSetType registered toinvalid reference
ForgeRegistries.HOLDER_SET_TYPES
unwrap()
net.minecraft.core.HolderSet
<T> value()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.neoforged.neoforge.registries.holdersets.ICustomHolderSet
serializationType
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
owners
-
registryLookup
-
value
-
list
-
-
Constructor Details
-
NotHolderSet
-
-
Method Details
-
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:IHolderSetExtension
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 interfaceIHolderSetExtension<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
- Specified by:
stream
in interfacenet.minecraft.core.HolderSet<T>
-
size
public int size()- Specified by:
size
in interfacenet.minecraft.core.HolderSet<T>
-
unwrap
public com.mojang.datafixers.util.Either<net.minecraft.tags.TagKey<T>,List<net.minecraft.core.Holder<T>>> unwrap()- Specified by:
unwrap
in interfacenet.minecraft.core.HolderSet<T>
-
getRandomElement
public Optional<net.minecraft.core.Holder<T>> getRandomElement(net.minecraft.util.RandomSource random) - Specified by:
getRandomElement
in interfacenet.minecraft.core.HolderSet<T>
-
get
- Specified by:
get
in interfacenet.minecraft.core.HolderSet<T>
-
contains
- Specified by:
contains
in interfacenet.minecraft.core.HolderSet<T>
-
canSerializeIn
- Specified by:
canSerializeIn
in interfacenet.minecraft.core.HolderSet<T>
-
unwrapKey
- Specified by:
unwrapKey
in interfacenet.minecraft.core.HolderSet<T>
-
toString
-
getList
-
invalidate
private void invalidate() -
isBound
public boolean isBound()- Specified by:
isBound
in interfacenet.minecraft.core.HolderSet<T>
-