Cleanup
This commit is contained in:
@@ -758,7 +758,7 @@ public class UnitType extends UnlockableContent implements Senseable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkEntityMapping(){
|
protected void checkEntityMapping(Unit example){
|
||||||
if(constructor == null) throw new IllegalArgumentException(Strings.format("""
|
if(constructor == null) throw new IllegalArgumentException(Strings.format("""
|
||||||
No constructor set up for unit '@': Assign `constructor = [your unit constructor]`. Vanilla defaults are:
|
No constructor set up for unit '@': Assign `constructor = [your unit constructor]`. Vanilla defaults are:
|
||||||
"flying": UnitEntity::create
|
"flying": UnitEntity::create
|
||||||
@@ -777,8 +777,6 @@ public class UnitType extends UnlockableContent implements Senseable{
|
|||||||
// In most cases, if the constructor is a Vanilla class, things should work just fine.
|
// In most cases, if the constructor is a Vanilla class, things should work just fine.
|
||||||
if(EntityMapping.map(name) == null) EntityMapping.nameMap.put(name, constructor);
|
if(EntityMapping.map(name) == null) EntityMapping.nameMap.put(name, constructor);
|
||||||
|
|
||||||
Unit example = constructor.get();
|
|
||||||
|
|
||||||
// Sanity checks; this is an EXTREMELY COMMON pitfalls Java modders fall into.
|
// Sanity checks; this is an EXTREMELY COMMON pitfalls Java modders fall into.
|
||||||
int classId = example.classId();
|
int classId = example.classId();
|
||||||
if(
|
if(
|
||||||
@@ -801,7 +799,9 @@ public class UnitType extends UnlockableContent implements Senseable{
|
|||||||
public void init(){
|
public void init(){
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
checkEntityMapping();
|
Unit example = constructor.get();
|
||||||
|
|
||||||
|
checkEntityMapping(example);
|
||||||
|
|
||||||
allowLegStep = example instanceof Legsc || example instanceof Crawlc;
|
allowLegStep = example instanceof Legsc || example instanceof Crawlc;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user