Registration rework (#3018)

Refactored component registration.

Fixes #3008: crank rendering
This commit is contained in:
fscan
2017-08-12 15:02:50 +02:00
committed by yueh
parent cdd76b7b22
commit 95b48b9438
37 changed files with 253 additions and 367 deletions
@@ -128,15 +128,13 @@ class ItemRendering implements IItemRendering
Block block = ( (ItemBlock) item ).getBlock();
// We can only do this once the blocks are actually registered...
StateMapperHelper helper = new StateMapperHelper( block.getRegistryName() );
StateMapperHelper helper = new StateMapperHelper( item.getRegistryName() );
model = helper.getModelResourceLocation( block.getDefaultState() );
}
else
{
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
resources.add( model );
}
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
}
@@ -147,17 +145,12 @@ class ItemRendering implements IItemRendering
{
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
}
else if( !this.itemModels.isEmpty() || this.itemMeshDefinition != null )
else if( this.itemMeshDefinition != null )
{
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
// case
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
}
else if( item instanceof ItemBlock )
{
// The default for block items is to register the block model
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
}
if( this.itemColor != null )
{