initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
20
java/src/game/init/RegistryDefaulted.java
Executable file
20
java/src/game/init/RegistryDefaulted.java
Executable file
|
@ -0,0 +1,20 @@
|
|||
package game.init;
|
||||
|
||||
public class RegistryDefaulted<K, V> extends RegistrySimple<K, V>
|
||||
{
|
||||
/**
|
||||
* Default object for this registry, returned when an object is not found.
|
||||
*/
|
||||
private final V defaultObject;
|
||||
|
||||
public RegistryDefaulted(V defaultObjectIn)
|
||||
{
|
||||
this.defaultObject = defaultObjectIn;
|
||||
}
|
||||
|
||||
public V getObject(K name)
|
||||
{
|
||||
V v = super.getObject(name);
|
||||
return (V)(v == null ? this.defaultObject : v);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue