类 CompositeHolderSet<T>
java.lang.Object
net.minecraftforge.registries.holdersets.CompositeHolderSet<T>
- 所有已实现的接口:
Iterable<Holder<T>>
,HolderSet<T>
,IForgeHolderSet<T>
,ICustomHolderSet<T>
- 直接已知子类:
AndHolderSet
,OrHolderSet
Composite holdersets have component holdersets and possibly owner holdersets
(which have this holderset as a component).
When their component holderset(s) invalidate, they clear any cached data and then
invalidate their owner holdersets.
-
嵌套类概要
从接口继承的嵌套类/接口 net.minecraft.core.HolderSet
HolderSet.Direct<T>, HolderSet.ListBacked<T>, HolderSet.Named<T>
从接口继承的嵌套类/接口 net.minecraftforge.common.extensions.IForgeHolderSet
IForgeHolderSet.SerializationType
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
addInvalidationListener
(Runnable runnable) Adds a callback to run when this holderset's contents invalidate (i.e. because tags were rebound).boolean
canSerializeIn
(HolderOwner<T> holderOwner) boolean
返回 immutable Set of Holders given this composite holderset's component holdersets。get
(int i) getList()
getRandomElement
(RandomSource rand) getSet()
Maps the sub-holdersets of this composite such that, if the list contains more than one element, and is non-homogenous, each element of the list will serialize as an object.private void
boolean
isBound()
boolean
iterator()
int
size()
stream()
unwrap()
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.minecraftforge.registries.holdersets.ICustomHolderSet
serializationType, type
从接口继承的方法 java.lang.Iterable
forEach, spliterator
-
字段详细资料
-
owners
-
components
-
set
-
list
-
-
构造器详细资料
-
CompositeHolderSet
-
-
方法详细资料
-
createSet
返回 immutable Set of Holders given this composite holderset's component holdersets。- 返回:
- immutable Set of Holders given this composite holderset's component holdersets
-
getComponents
-
getSet
-
getList
-
addInvalidationListener
从接口复制的说明: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.
- 指定者:
addInvalidationListener
在接口中IForgeHolderSet<T>
- 参数:
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.
-
invalidate
private void invalidate() -
stream
-
size
public int size() -
unwrap
-
getRandomElement
- 指定者:
getRandomElement
在接口中HolderSet<T>
-
get
-
contains
-
canSerializeIn
- 指定者:
canSerializeIn
在接口中HolderSet<T>
-
isBound
public boolean isBound() -
unwrapKey
-
iterator
-
homogenize
Maps the sub-holdersets of this composite such that, if the list contains more than one element, and is non-homogenous, each element of the list will serialize as an object. Prevents crashes from trying to serialize non-homogenous lists to NBT. Lists are considered non-homogenous if it contains more than one serialization type of holderset. Holdersets may be serialized as strings, lists, or maps.- 返回:
- List of holdersets with homogenous serialization behavior. Returns a new List if size > 1 and serialization would be non-homogenous, otherwise returns the composite's existing List.
-
isHomogenous
public boolean isHomogenous()- 返回:
- True if all of our sub-holdersets have the same
IForgeHolderSet.SerializationType
(string, list, or object). False if we have more than one holderset AND if either we have more than one serialization type among them, or any holderset is引用无效
SerializationType.UNKNOWN
-