mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-19 11:59:08 +00:00
Added method to replace micro materials
This commit is contained in:
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
|
||||
|
||||
Reference in new issue
Block a user