Added method to replace micro materials

This commit is contained in:
Chicken Bones committed 2013-08-19 08:04:34 +10:00
1 parent 8b49a6c579
commit 4f7ddb7005
1 file changed
+13 -1
@@ -73,7 +73,7 @@ object MicroMaterialRegistry
def registerMaterial(material:IMicroMaterial, name:String)
{
if(MultiPartRegistry.loaded)
throw new IllegalStateException("You must register your parts in the init methods.")
throw new IllegalStateException("You must register your materials in the init methods.")
if(typeMap.contains(name))
throw new IllegalStateException("Material with id "+name+" is already registered.")
@@ -83,6 +83,18 @@ object MicroMaterialRegistry
typeMap.put(name, material)
}
def replaceMaterial(material:IMicroMaterial, name:String) {
if(MultiPartRegistry.loaded)
throw new IllegalStateException("You must register your materials in the init methods.")
if(typeMap.remove(name).isEmpty)
System.err.println("Material with id "+name+" is was not registered.")
System.out.println("Replaced micro material: "+name)
typeMap.put(name, material)
}
def registerHighlightRenderer(handler:IMicroHighlightRenderer)
{
highlightRenderers+=handler