Package net.minecraftforge.registries
Class ForgeRegistry<V extends IForgeRegistryEntry<V>>
- java.lang.Object
-
- net.minecraftforge.registries.ForgeRegistry<V>
-
- All Implemented Interfaces:
java.lang.Iterable<V>,IForgeRegistry<V>,IForgeRegistryInternal<V>,IForgeRegistryModifiable<V>
public class ForgeRegistry<V extends IForgeRegistryEntry<V>> extends java.lang.Object implements IForgeRegistryInternal<V>, IForgeRegistryModifiable<V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classForgeRegistry.DumpRowprivate static classForgeRegistry.OverrideOwnerstatic classForgeRegistry.Snapshot-
Nested classes/interfaces inherited from interface net.minecraftforge.registries.IForgeRegistry
IForgeRegistry.AddCallback<V extends IForgeRegistryEntry<V>>, IForgeRegistry.BakeCallback<V extends IForgeRegistryEntry<V>>, IForgeRegistry.ClearCallback<V extends IForgeRegistryEntry<V>>, IForgeRegistry.CreateCallback<V extends IForgeRegistryEntry<V>>, IForgeRegistry.DummyFactory<V extends IForgeRegistryEntry<V>>, IForgeRegistry.MissingFactory<V extends IForgeRegistryEntry<V>>, IForgeRegistry.ValidateCallback<V extends IForgeRegistryEntry<V>>
-
-
Field Summary
Fields Modifier and Type Field Description private IForgeRegistry.AddCallback<V>addprivate java.util.Map<ResourceLocation,ResourceLocation>aliasesprivate booleanallowOverridesprivate java.util.BitSetavailabilityMapprivate IForgeRegistry.BakeCallback<V>bakeprivate java.util.Set<java.lang.Integer>blockedprivate RegistryBuilder<V>builderprivate IForgeRegistry.ClearCallback<V>clearprivate IForgeRegistry.CreateCallback<V>createprivate ResourceLocationdefaultKeyprivate VdefaultValueprivate java.util.Set<ResourceLocation>dummiesprivate IForgeRegistry.DummyFactory<V>dummyFactoryprivate com.google.common.collect.BiMap<java.lang.Integer,V>idsprivate booleanisDelegated(package private) booleanisFrozenprivate booleanisModifiableprivate RegistryKey<Registry<V>>keyprivate com.google.common.collect.BiMap<RegistryKey<V>,V>keysprivate static org.apache.logging.log4j.LoggerLOGGERprivate intmaxprivate intminprivate IForgeRegistry.MissingFactory<V>missingprivate ResourceLocationnameprivate com.google.common.collect.BiMap<ResourceLocation,V>namesprivate com.google.common.collect.Multimap<ResourceLocation,V>overridesprivate com.google.common.collect.BiMap<ForgeRegistry.OverrideOwner,V>ownersstatic org.apache.logging.log4j.MarkerREGISTRIESprivate static org.apache.logging.log4j.MarkerREGISTRYDUMP(package private) java.util.Map<ResourceLocation,?>slavesprivate RegistryManagerstageprivate java.lang.Class<V>superTypeprivate java.lang.StringtagFolderprivate IForgeRegistry.ValidateCallback<V>validate
-
Constructor Summary
Constructors Constructor Description ForgeRegistry(RegistryManager stage, ResourceLocation name, RegistryBuilder<V> builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intadd(int id, V value)(package private) intadd(int id, V value, java.lang.String owner)(package private) voidaddAlias(ResourceLocation from, ResourceLocation to)(package private) voidaddDummy(ResourceLocation key)voidbake()(package private) voidblock(int id)voidclear()booleancontainsKey(ResourceLocation key)booleancontainsValue(V value)(package private) ForgeRegistry<V>copy(RegistryManager stage)(package private) voiddump(ResourceLocation name)voidfreeze()Used to control the times where people can modify this registry.(package private) VgetDefault()ResourceLocationgetDefaultKey()private RegistryDelegate<V>getDelegate(V thing)java.util.Set<java.util.Map.Entry<RegistryKey<V>,V>>getEntries()intgetID(ResourceLocation name)intgetID(V value)private intgetIDRaw(ResourceLocation name)private intgetIDRaw(V value)RegistryKey<V>getKey(int id)ResourceLocationgetKey(V value)java.util.Set<ResourceLocation>getKeys()RegistryEvent.MissingMappings<?>getMissingEvent(ResourceLocation name, java.util.Map<ResourceLocation,java.lang.Integer> map)(package private) java.util.Map<ResourceLocation,java.lang.String>getOverrideOwners()VgetRaw(ResourceLocation key)(package private) RegistryEvent.Register<V>getRegisterEvent(ResourceLocation name)RegistryKey<Registry<V>>getRegistryKey()ResourceLocationgetRegistryName()java.lang.Class<V>getRegistrySuperType()<T> TgetSlaveMap(ResourceLocation name, java.lang.Class<T> type)Retrieve the slave map of type T from the registry.java.lang.StringgetTagFolder()VgetValue(int id)VgetValue(ResourceLocation key)java.util.Collection<V>getValues()(package private) booleanisDummied(ResourceLocation key)booleanisEmpty()booleanisLocked()java.util.Iterator<V>iterator()voidloadIds(java.util.Map<ResourceLocation,java.lang.Integer> ids, java.util.Map<ResourceLocation,java.lang.String> overrides, java.util.Map<ResourceLocation,java.lang.Integer> missing, java.util.Map<ResourceLocation,java.lang.Integer[]> remapped, ForgeRegistry<V> old, ResourceLocation name)ForgeRegistry.SnapshotmakeSnapshot()(package private) booleanmarkDummy(ResourceLocation key, int id)(package private) voidprocessMissingEvent(ResourceLocation name, ForgeRegistry<V> pool, java.util.List<RegistryEvent.MissingMappings.Mapping<V>> mappings, java.util.Map<ResourceLocation,java.lang.Integer> missing, java.util.Map<ResourceLocation,java.lang.Integer[]> remaps, java.util.Collection<ResourceLocation> defaulted, java.util.Collection<ResourceLocation> failed, boolean injectNetworkDummies)voidregister(V value)voidregisterAll(V... values)Vremove(ResourceLocation key)(package private) voidresetDelegates()voidsetSlaveMap(ResourceLocation name, java.lang.Object obj)(package private) voidsync(ResourceLocation name, ForgeRegistry<V> from)voidunfreeze()(package private) voidvalidateContent(ResourceLocation registryName)(package private) voidvalidateKey()
-
-
-
Field Detail
-
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
private final RegistryManager stage
-
ids
private final com.google.common.collect.BiMap<java.lang.Integer,V extends IForgeRegistryEntry<V>> ids
-
names
private final com.google.common.collect.BiMap<ResourceLocation,V extends IForgeRegistryEntry<V>> names
-
keys
private final com.google.common.collect.BiMap<RegistryKey<V extends IForgeRegistryEntry<V>>,V extends IForgeRegistryEntry<V>> keys
-
superType
private final java.lang.Class<V extends IForgeRegistryEntry<V>> superType
-
aliases
private final java.util.Map<ResourceLocation,ResourceLocation> aliases
-
slaves
final java.util.Map<ResourceLocation,?> slaves
-
defaultKey
private final ResourceLocation defaultKey
-
create
private final IForgeRegistry.CreateCallback<V extends IForgeRegistryEntry<V>> create
-
add
private final IForgeRegistry.AddCallback<V extends IForgeRegistryEntry<V>> add
-
clear
private final IForgeRegistry.ClearCallback<V extends IForgeRegistryEntry<V>> clear
-
validate
private final IForgeRegistry.ValidateCallback<V extends IForgeRegistryEntry<V>> validate
-
bake
private final IForgeRegistry.BakeCallback<V extends IForgeRegistryEntry<V>> bake
-
missing
private final IForgeRegistry.MissingFactory<V extends IForgeRegistryEntry<V>> missing
-
availabilityMap
private final java.util.BitSet availabilityMap
-
dummies
private final java.util.Set<ResourceLocation> dummies
-
blocked
private final java.util.Set<java.lang.Integer> blocked
-
overrides
private final com.google.common.collect.Multimap<ResourceLocation,V extends IForgeRegistryEntry<V>> overrides
-
owners
private final com.google.common.collect.BiMap<ForgeRegistry.OverrideOwner,V extends IForgeRegistryEntry<V>> owners
-
dummyFactory
private final IForgeRegistry.DummyFactory<V extends IForgeRegistryEntry<V>> dummyFactory
-
isDelegated
private final boolean isDelegated
-
min
private final int min
-
max
private final int max
-
allowOverrides
private final boolean allowOverrides
-
isModifiable
private final boolean isModifiable
-
tagFolder
@Nullable private final java.lang.String tagFolder
-
defaultValue
private V extends IForgeRegistryEntry<V> defaultValue
-
isFrozen
boolean isFrozen
-
name
private final ResourceLocation name
-
key
private final RegistryKey<Registry<V extends IForgeRegistryEntry<V>>> key
-
builder
private final RegistryBuilder<V extends IForgeRegistryEntry<V>> builder
-
-
Constructor Detail
-
ForgeRegistry
ForgeRegistry(RegistryManager stage, ResourceLocation name, RegistryBuilder<V> builder)
-
-
Method Detail
-
register
public void register(V value)
- Specified by:
registerin interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
iterator
public java.util.Iterator<V> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<V extends IForgeRegistryEntry<V>>
-
getRegistryName
public ResourceLocation getRegistryName()
- Specified by:
getRegistryNamein interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getRegistryKey
public RegistryKey<Registry<V>> getRegistryKey()
-
getRegistrySuperType
public java.lang.Class<V> getRegistrySuperType()
- Specified by:
getRegistrySuperTypein interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getTagFolder
@Nullable public java.lang.String getTagFolder()
-
registerAll
public void registerAll(V... values)
- Specified by:
registerAllin interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
containsKey
public boolean containsKey(ResourceLocation key)
- Specified by:
containsKeyin interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
containsValue
public boolean containsValue(V value)
- Specified by:
containsValuein interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getValue
public V getValue(ResourceLocation key)
- Specified by:
getValuein interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getKey
public ResourceLocation getKey(V value)
- Specified by:
getKeyin interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getKeys
public java.util.Set<ResourceLocation> getKeys()
- Specified by:
getKeysin interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getValues
@Nonnull public java.util.Collection<V> getValues()
- Specified by:
getValuesin interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getEntries
public java.util.Set<java.util.Map.Entry<RegistryKey<V>,V>> getEntries()
- Specified by:
getEntriesin interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getSlaveMap
public <T> T getSlaveMap(ResourceLocation name, java.lang.Class<T> type)
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 extends IForgeRegistryEntry<V>>- Type Parameters:
T- Type to return- Parameters:
name- The name of the slavemaptype- The type- Returns:
- The slavemap if present
-
setSlaveMap
public void setSlaveMap(ResourceLocation name, java.lang.Object obj)
- Specified by:
setSlaveMapin interfaceIForgeRegistryInternal<V extends IForgeRegistryEntry<V>>
-
getID
public int getID(V value)
-
getID
public int getID(ResourceLocation name)
-
getIDRaw
private int getIDRaw(V value)
-
getIDRaw
private int getIDRaw(ResourceLocation name)
-
getValue
public V getValue(int id)
-
getKey
@Nullable public RegistryKey<V> getKey(int id)
-
validateKey
void validateKey()
-
getDefaultKey
@Nullable public ResourceLocation getDefaultKey()
- Specified by:
getDefaultKeyin interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
copy
ForgeRegistry<V> copy(RegistryManager stage)
-
add
int add(int id, V value)
-
add
int add(int id, V value, java.lang.String owner)
-
getRaw
public V getRaw(ResourceLocation key)
-
addAlias
void addAlias(ResourceLocation from, ResourceLocation to)
-
addDummy
void addDummy(ResourceLocation key)
-
getDelegate
private RegistryDelegate<V> getDelegate(V thing)
-
resetDelegates
void resetDelegates()
-
getDefault
V getDefault()
-
isDummied
boolean isDummied(ResourceLocation key)
-
validateContent
void validateContent(ResourceLocation registryName)
-
bake
public void bake()
-
sync
void sync(ResourceLocation name, ForgeRegistry<V> from)
-
clear
public void clear()
- Specified by:
clearin interfaceIForgeRegistryModifiable<V extends IForgeRegistryEntry<V>>
-
remove
public V remove(ResourceLocation key)
- Specified by:
removein interfaceIForgeRegistryModifiable<V extends IForgeRegistryEntry<V>>
-
block
void block(int id)
-
isLocked
public boolean isLocked()
- Specified by:
isLockedin interfaceIForgeRegistryModifiable<V extends IForgeRegistryEntry<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()
-
getRegisterEvent
RegistryEvent.Register<V> getRegisterEvent(ResourceLocation name)
-
dump
void dump(ResourceLocation name)
-
loadIds
public void loadIds(java.util.Map<ResourceLocation,java.lang.Integer> ids, java.util.Map<ResourceLocation,java.lang.String> overrides, java.util.Map<ResourceLocation,java.lang.Integer> missing, java.util.Map<ResourceLocation,java.lang.Integer[]> remapped, ForgeRegistry<V> old, ResourceLocation name)
-
markDummy
boolean markDummy(ResourceLocation key, int id)
-
makeSnapshot
public ForgeRegistry.Snapshot makeSnapshot()
-
getOverrideOwners
java.util.Map<ResourceLocation,java.lang.String> getOverrideOwners()
-
getMissingEvent
public RegistryEvent.MissingMappings<?> getMissingEvent(ResourceLocation name, java.util.Map<ResourceLocation,java.lang.Integer> map)
-
processMissingEvent
void processMissingEvent(ResourceLocation name, ForgeRegistry<V> pool, java.util.List<RegistryEvent.MissingMappings.Mapping<V>> mappings, java.util.Map<ResourceLocation,java.lang.Integer> missing, java.util.Map<ResourceLocation,java.lang.Integer[]> remaps, java.util.Collection<ResourceLocation> defaulted, java.util.Collection<ResourceLocation> failed, boolean injectNetworkDummies)
-
-