mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
Simplify model loading code.
This commit is contained in:
parent
4929075212
commit
4de7be9e41
@ -16,12 +16,9 @@ namespace ClassicalSharp.Model {
|
|||||||
IModel model;
|
IModel model;
|
||||||
byte blockId;
|
byte blockId;
|
||||||
if( Byte.TryParse( modelName, out blockId ) ) {
|
if( Byte.TryParse( modelName, out blockId ) ) {
|
||||||
if( !cache.TryGetValue( "block", out model ) ) {
|
modelName = "block";
|
||||||
model = new BlockModel( window );
|
|
||||||
cache["block"] = model;
|
|
||||||
}
|
}
|
||||||
return model;
|
|
||||||
} else {
|
|
||||||
if( !cache.TryGetValue( modelName, out model ) ) {
|
if( !cache.TryGetValue( modelName, out model ) ) {
|
||||||
model = InitModel( modelName );
|
model = InitModel( modelName );
|
||||||
if( model != null ) {
|
if( model != null ) {
|
||||||
@ -32,7 +29,6 @@ namespace ClassicalSharp.Model {
|
|||||||
}
|
}
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
IModel InitModel( string modelName ) {
|
IModel InitModel( string modelName ) {
|
||||||
if( modelName == "chicken" ) {
|
if( modelName == "chicken" ) {
|
||||||
@ -49,6 +45,8 @@ namespace ClassicalSharp.Model {
|
|||||||
return new SpiderModel( window );
|
return new SpiderModel( window );
|
||||||
} else if( modelName == "zombie" ) {
|
} else if( modelName == "zombie" ) {
|
||||||
return new ZombieModel( window );
|
return new ZombieModel( window );
|
||||||
|
} else if( modelName == "block" ) {
|
||||||
|
return new BlockModel( window );
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user