Package net.minecraftforge.registries
Class ForgeRegistry<V>
java.lang.Object
net.minecraftforge.registries.ForgeRegistry<V>
- All Implemented Interfaces:
Iterable<V>,IForgeRegistry<V>,IForgeRegistryInternal<V>,IForgeRegistryModifiable<V>
public class ForgeRegistry<V>
extends Object
implements IForgeRegistryInternal<V>, IForgeRegistryModifiable<V>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordprivate static final recordprivate classstatic classNested classes/interfaces inherited from interface net.minecraftforge.registries.IForgeRegistry
IForgeRegistry.AddCallback<V>, IForgeRegistry.BakeCallback<V>, IForgeRegistry.ClearCallback<V>, IForgeRegistry.CreateCallback<V>, IForgeRegistry.DummyFactory<V>, IForgeRegistry.MissingFactory<V>, IForgeRegistry.ValidateCallback<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IForgeRegistry.AddCallback<V>private final Map<ResourceLocation,ResourceLocation> private final booleanprivate final BitSetprivate final IForgeRegistry.BakeCallback<V>private final RegistryBuilder<V>private final IForgeRegistry.ClearCallback<V>private final com.mojang.serialization.Codec<V>private final IForgeRegistry.CreateCallback<V>private final ResourceLocationprivate final ResourceKey<V>private Vprivate final Map<ResourceLocation,Holder.Reference<V>> private final Map<V,Holder.Reference<V>> private final Set<ResourceLocation>private final IForgeRegistry.DummyFactory<V>private final boolean(package private) booleanprivate final booleanprivate final ResourceKey<Registry<V>>private final com.google.common.collect.BiMap<ResourceKey<V>,V> private static org.apache.logging.log4j.Loggerprivate final intprivate final intprivate final IForgeRegistry.MissingFactory<V>private final ResourceLocationprivate final com.google.common.collect.BiMap<ResourceLocation,V> private final com.google.common.collect.Multimap<ResourceLocation,V> private final com.google.common.collect.BiMap<ForgeRegistry.OverrideOwner<V>,V> static org.apache.logging.log4j.Markerprivate static org.apache.logging.log4j.Marker(package private) final Map<ResourceLocation,?> private final RegistryManagerprivate final ForgeRegistryTagManager<V>private final IForgeRegistry.ValidateCallback<V> -
Constructor Summary
ConstructorsConstructorDescriptionForgeRegistry(RegistryManager stage, ResourceLocation name, RegistryBuilder<V> builder) -
Method Summary
Modifier and TypeMethodDescription(package private) intadd(int id, ResourceLocation key, V value) (package private) intadd(int id, ResourceLocation key, V value, String owner) (package private) voidaddAlias(ResourceLocation from, ResourceLocation to) (package private) voidaddDummy(ResourceLocation key) voidbake()private Holder.Reference<V>bindDelegate(ResourceKey<V> rkey, V value) (package private) voidblock(int id) voidclear()booleanbooleancontainsValue(V value) (package private) ForgeRegistry<V>copy(RegistryManager stage) private voidcreateAndAddDummy(ResourceLocation key, int id) (package private) voiddump(ResourceLocation name) voidfreeze()Used to control the times where people can modify this registry.(package private) RegistryBuilder<V>@NotNull com.mojang.serialization.Codec<V>getCodec()(package private) V@Nullable ResourceLocation@NotNull Optional<Holder.Reference<V>>getDelegate(ResourceKey<V> rkey) @NotNull Optional<Holder.Reference<V>>@NotNull Optional<Holder.Reference<V>>getDelegate(V value) getDelegateOrThrow(ResourceKey<V> rkey) getDelegateOrThrow(V value) @NotNull Set<Map.Entry<ResourceKey<V>,V>> getHolder(ResourceKey<V> key) This method exists purely as a stopgap for vanilla compatibility.getHolder(ResourceLocation location) This method exists purely as a stopgap for vanilla compatibility.This method exists purely as a stopgap for vanilla compatibility.intgetID(ResourceLocation name) intprivate intgetIDRaw(ResourceLocation name) private int@Nullable ResourceKey<V>getKey(int id) @NotNull Set<ResourceLocation>getKeys()getMissingEvent(ResourceLocation name, Map<ResourceLocation, Integer> map) (package private) Map<ResourceLocation,String> getRaw(ResourceLocation key) @NotNull Optional<ResourceKey<V>>getResourceKey(V value) (package private) @NotNull Set<ResourceKey<V>><T> TgetSlaveMap(ResourceLocation name, Class<T> type) Retrieve the slave map of type T from the registry.getValue(int id) getValue(ResourceLocation key) @NotNull Collection<V>(package private) @Nullable NamespacedWrapper<V>(package private) @NotNull NamespacedWrapper<V>(package private) booleanbooleanisEmpty()booleanisLocked()iterator()voidloadIds(Map<ResourceLocation, Integer> ids, Map<ResourceLocation, String> overrides, Map<ResourceLocation, Integer> missing, Map<ResourceLocation, IdMappingEvent.IdRemapping> remapped, ForgeRegistry<V> old, ResourceLocation name) (package private) booleanmarkDummy(ResourceLocation key, int id) (package private) voidonBindTags(Map<TagKey<V>, HolderSet.Named<V>> tags, Set<TagKey<V>> defaultedTags) (package private) voidprocessMissingEvent(ResourceLocation name, ForgeRegistry<V> pool, List<MissingMappingsEvent.Mapping<V>> mappings, Map<ResourceLocation, Integer> missing, Map<ResourceLocation, IdMappingEvent.IdRemapping> remaps, Collection<ResourceLocation> defaulted, Collection<ResourceLocation> failed, boolean injectNetworkDummies) voidThe supplied string key will be prefixed with the currently active mod's mod id.voidregister(ResourceLocation key, V value) remove(ResourceLocation key) (package private) voidvoidsetSlaveMap(ResourceLocation name, Object obj) (package private) intsize()(package private) voidsync(ResourceLocation name, ForgeRegistry<V> from) @Nullable ITagManager<V>tags()voidunfreeze()(package private) voidvalidateContent(ResourceLocation registryName) (package private) voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
REGISTRIES
public static org.apache.logging.log4j.Marker REGISTRIES -
REGISTRYDUMP
private static org.apache.logging.log4j.Marker REGISTRYDUMP -
LOGGER
private static org.apache.logging.log4j.Logger LOGGER -
stage
-
ids
-
names
-
keys
-
aliases
-
slaves
-
defaultKey
-
defaultResourceKey
-
create
-
add
-
clear
-
validate
-
bake
-
missing
-
availabilityMap
-
dummies
-
blocked
-
overrides
-
delegatesByName
-
delegatesByValue
-
owners
-
tagManager
-
dummyFactory
-
min
private final int min -
max
private final int max -
allowOverrides
private final boolean allowOverrides -
isModifiable
private final boolean isModifiable -
hasWrapper
private final boolean hasWrapper -
defaultValue
-
isFrozen
boolean isFrozen -
name
-
key
-
builder
-
codec
-
-
Constructor Details
-
ForgeRegistry
ForgeRegistry(RegistryManager stage, ResourceLocation name, RegistryBuilder<V> builder)
-
-
Method Details
-
register
Description copied from interface:IForgeRegistryThe supplied string key will be prefixed with the currently active mod's mod id. If the supplied name already has a prefix that is different, it will be used and a warning will be logged.- Specified by:
registerin interfaceIForgeRegistry<V>
-
register
- Specified by:
registerin interfaceIForgeRegistry<V>
-
iterator
-
getRegistryName
- Specified by:
getRegistryNamein interfaceIForgeRegistry<V>
-
getRegistryKey
- Specified by:
getRegistryKeyin interfaceIForgeRegistry<V>
-
getCodec
- Specified by:
getCodecin interfaceIForgeRegistry<V>- See Also:
-
containsKey
- Specified by:
containsKeyin interfaceIForgeRegistry<V>
-
containsValue
- Specified by:
containsValuein interfaceIForgeRegistry<V>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceIForgeRegistry<V>
-
size
int size() -
getValue
- Specified by:
getValuein interfaceIForgeRegistry<V>
-
getKey
- Specified by:
getKeyin interfaceIForgeRegistry<V>
-
getResourceKey
- Specified by:
getResourceKeyin interfaceIForgeRegistry<V>
-
getWrapper
-
getWrapperOrThrow
-
onBindTags
-
getHolder
Description copied from interface:IForgeRegistryThis method exists purely as a stopgap for vanilla compatibility. For anything tag related, useIForgeRegistry.tags().- Specified by:
getHolderin interfaceIForgeRegistry<V>- See Also:
-
getHolder
Description copied from interface:IForgeRegistryThis method exists purely as a stopgap for vanilla compatibility. For anything tag related, useIForgeRegistry.tags().- Specified by:
getHolderin interfaceIForgeRegistry<V>
-
getHolder
Description copied from interface:IForgeRegistryThis method exists purely as a stopgap for vanilla compatibility. For anything tag related, useIForgeRegistry.tags().- Specified by:
getHolderin interfaceIForgeRegistry<V>
-
tags
- Specified by:
tagsin interfaceIForgeRegistry<V>- Returns:
- an instance of
ITagManagerif this registry supports tags and/or has a wrapper registry, null otherwise
-
getKeys
- Specified by:
getKeysin interfaceIForgeRegistry<V>
-
getResourceKeys
-
getValues
- Specified by:
getValuesin interfaceIForgeRegistry<V>
-
getEntries
- Specified by:
getEntriesin interfaceIForgeRegistry<V>
-
getSlaveMap
Description copied from interface:IForgeRegistryRetrieve the slave map of type T from the registry. Slave maps are maps which are dependent on registry content in some way.- Specified by:
getSlaveMapin interfaceIForgeRegistry<V>- Type Parameters:
T- Type to return- Parameters:
name- The name of the slavemaptype- The type- Returns:
- The slavemap if present
-
setSlaveMap
- Specified by:
setSlaveMapin interfaceIForgeRegistryInternal<V>
-
getID
-
getID
-
getIDRaw
-
getIDRaw
-
getValue
-
getKey
-
validateKey
void validateKey() -
getDefaultKey
- Specified by:
getDefaultKeyin interfaceIForgeRegistry<V>
-
copy
-
add
-
add
-
getRaw
-
addAlias
-
addDummy
-
getDelegate
- Specified by:
getDelegatein interfaceIForgeRegistry<V>
-
getDelegateOrThrow
- Specified by:
getDelegateOrThrowin interfaceIForgeRegistry<V>
-
getDelegate
- Specified by:
getDelegatein interfaceIForgeRegistry<V>
-
getDelegateOrThrow
- Specified by:
getDelegateOrThrowin interfaceIForgeRegistry<V>
-
getDelegate
- Specified by:
getDelegatein interfaceIForgeRegistry<V>
-
getDelegateOrThrow
- Specified by:
getDelegateOrThrowin interfaceIForgeRegistry<V>
-
bindDelegate
-
resetDelegates
void resetDelegates() -
getDefault
V getDefault() -
isDummied
-
validateContent
-
bake
public void bake() -
sync
-
clear
public void clear()- Specified by:
clearin interfaceIForgeRegistryModifiable<V>
-
remove
- Specified by:
removein interfaceIForgeRegistryModifiable<V>
-
block
void block(int id) -
isLocked
public boolean isLocked()- Specified by:
isLockedin interfaceIForgeRegistryModifiable<V>
-
freeze
public void freeze()Used to control the times where people can modify this registry. Users should only ever register things in the Register<?> events! -
unfreeze
public void unfreeze() -
dump
-
loadIds
public void loadIds(Map<ResourceLocation, Integer> ids, Map<ResourceLocation, String> overrides, Map<ResourceLocation, Integer> missing, Map<ResourceLocation, IdMappingEvent.IdRemapping> remapped, ForgeRegistry<V> old, ResourceLocation name) -
markDummy
-
createAndAddDummy
-
makeSnapshot
-
getOverrideOwners
Map<ResourceLocation,String> getOverrideOwners() -
getMissingEvent
public MissingMappingsEvent getMissingEvent(ResourceLocation name, Map<ResourceLocation, Integer> map) -
processMissingEvent
void processMissingEvent(ResourceLocation name, ForgeRegistry<V> pool, List<MissingMappingsEvent.Mapping<V>> mappings, Map<ResourceLocation, Integer> missing, Map<ResourceLocation, IdMappingEvent.IdRemapping> remaps, Collection<ResourceLocation> defaulted, Collection<ResourceLocation> failed, boolean injectNetworkDummies) -
getBuilder
RegistryBuilder<V> getBuilder()
-