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 class
ForgeRegistry.DumpRow
private static class
ForgeRegistry.OverrideOwner
static class
ForgeRegistry.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>
add
private java.util.Map<ResourceLocation,ResourceLocation>
aliases
private boolean
allowOverrides
private java.util.BitSet
availabilityMap
private IForgeRegistry.BakeCallback<V>
bake
private java.util.Set<java.lang.Integer>
blocked
private RegistryBuilder<V>
builder
private IForgeRegistry.ClearCallback<V>
clear
private IForgeRegistry.CreateCallback<V>
create
private ResourceLocation
defaultKey
private V
defaultValue
private java.util.Set<ResourceLocation>
dummies
private IForgeRegistry.DummyFactory<V>
dummyFactory
private com.google.common.collect.BiMap<java.lang.Integer,V>
ids
private boolean
isDelegated
(package private) boolean
isFrozen
private boolean
isModifiable
private RegistryKey<Registry<V>>
key
private com.google.common.collect.BiMap<RegistryKey<V>,V>
keys
private static org.apache.logging.log4j.Logger
LOGGER
private int
max
private int
min
private IForgeRegistry.MissingFactory<V>
missing
private ResourceLocation
name
private com.google.common.collect.BiMap<ResourceLocation,V>
names
private com.google.common.collect.Multimap<ResourceLocation,V>
overrides
private com.google.common.collect.BiMap<ForgeRegistry.OverrideOwner,V>
owners
static org.apache.logging.log4j.Marker
REGISTRIES
private static org.apache.logging.log4j.Marker
REGISTRYDUMP
(package private) java.util.Map<ResourceLocation,?>
slaves
private RegistryManager
stage
private java.lang.Class<V>
superType
private java.lang.String
tagFolder
private 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) int
add(int id, V value)
(package private) int
add(int id, V value, java.lang.String owner)
(package private) void
addAlias(ResourceLocation from, ResourceLocation to)
(package private) void
addDummy(ResourceLocation key)
void
bake()
(package private) void
block(int id)
void
clear()
boolean
containsKey(ResourceLocation key)
boolean
containsValue(V value)
(package private) ForgeRegistry<V>
copy(RegistryManager stage)
(package private) void
dump(ResourceLocation name)
void
freeze()
Used to control the times where people can modify this registry.(package private) V
getDefault()
ResourceLocation
getDefaultKey()
private RegistryDelegate<V>
getDelegate(V thing)
java.util.Set<java.util.Map.Entry<RegistryKey<V>,V>>
getEntries()
int
getID(ResourceLocation name)
int
getID(V value)
private int
getIDRaw(ResourceLocation name)
private int
getIDRaw(V value)
RegistryKey<V>
getKey(int id)
ResourceLocation
getKey(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()
V
getRaw(ResourceLocation key)
(package private) RegistryEvent.Register<V>
getRegisterEvent(ResourceLocation name)
RegistryKey<Registry<V>>
getRegistryKey()
ResourceLocation
getRegistryName()
java.lang.Class<V>
getRegistrySuperType()
<T> T
getSlaveMap(ResourceLocation name, java.lang.Class<T> type)
Retrieve the slave map of type T from the registry.java.lang.String
getTagFolder()
V
getValue(int id)
V
getValue(ResourceLocation key)
java.util.Collection<V>
getValues()
(package private) boolean
isDummied(ResourceLocation key)
boolean
isEmpty()
boolean
isLocked()
java.util.Iterator<V>
iterator()
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)
ForgeRegistry.Snapshot
makeSnapshot()
(package private) boolean
markDummy(ResourceLocation key, int id)
(package private) 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)
void
register(V value)
void
registerAll(V... values)
V
remove(ResourceLocation key)
(package private) void
resetDelegates()
void
setSlaveMap(ResourceLocation name, java.lang.Object obj)
(package private) void
sync(ResourceLocation name, ForgeRegistry<V> from)
void
unfreeze()
(package private) void
validateContent(ResourceLocation registryName)
(package private) void
validateKey()
-
-
-
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:
register
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
iterator
public java.util.Iterator<V> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<V extends IForgeRegistryEntry<V>>
-
getRegistryName
public ResourceLocation getRegistryName()
- Specified by:
getRegistryName
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getRegistryKey
public RegistryKey<Registry<V>> getRegistryKey()
-
getRegistrySuperType
public java.lang.Class<V> getRegistrySuperType()
- Specified by:
getRegistrySuperType
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getTagFolder
@Nullable public java.lang.String getTagFolder()
-
registerAll
public void registerAll(V... values)
- Specified by:
registerAll
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
containsKey
public boolean containsKey(ResourceLocation key)
- Specified by:
containsKey
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
containsValue
public boolean containsValue(V value)
- Specified by:
containsValue
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getValue
public V getValue(ResourceLocation key)
- Specified by:
getValue
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getKey
public ResourceLocation getKey(V value)
- Specified by:
getKey
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getKeys
public java.util.Set<ResourceLocation> getKeys()
- Specified by:
getKeys
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getValues
@Nonnull public java.util.Collection<V> getValues()
- Specified by:
getValues
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getEntries
public java.util.Set<java.util.Map.Entry<RegistryKey<V>,V>> getEntries()
- Specified by:
getEntries
in interfaceIForgeRegistry<V extends IForgeRegistryEntry<V>>
-
getSlaveMap
public <T> T getSlaveMap(ResourceLocation name, java.lang.Class<T> type)
Description copied from interface:IForgeRegistry
Retrieve the slave map of type T from the registry. Slave maps are maps which are dependent on registry content in some way.- Specified by:
getSlaveMap
in 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:
setSlaveMap
in 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:
getDefaultKey
in 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:
clear
in interfaceIForgeRegistryModifiable<V extends IForgeRegistryEntry<V>>
-
remove
public V remove(ResourceLocation key)
- Specified by:
remove
in interfaceIForgeRegistryModifiable<V extends IForgeRegistryEntry<V>>
-
block
void block(int id)
-
isLocked
public boolean isLocked()
- Specified by:
isLocked
in 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)
-
-