Fixes vibrant quartz glass using the wrong model.

Fixes matrix frame not having a model (the block is transparent though).
Don't register an item model for the invalid part anymore.
Make variant registration for items more explicit.
This fixes #5
This commit is contained in:
Sebastian Hartte 2016-09-10 13:19:21 +02:00
parent 418e44390d
commit 3403e47b02
8 changed files with 33 additions and 33 deletions

View File

@ -29,7 +29,8 @@ public class SkyChestRenderingCustomizer extends BlockRenderingCustomizer
// Register a custom non-tesr item model
String modelName = getModelFromType();
itemRendering.model( new ModelResourceLocation( "appliedenergistics2:" + modelName, "inventory" ) );
ModelResourceLocation model = new ModelResourceLocation( "appliedenergistics2:" + modelName, "inventory" );
itemRendering.model( model ).variants( model );
}
private String getModelFromType()

View File

@ -130,7 +130,8 @@ class BlockDefinitionBuilder implements IBlockBuilder
@SideOnly( Side.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
itemRendering.model( new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, registryName ), "inventory" ) );
ModelResourceLocation model = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, registryName ), "inventory" );
itemRendering.model( model ).variants( model );
}
} );

View File

@ -2,6 +2,7 @@ package appeng.bootstrap;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@ -127,6 +128,16 @@ class ItemRendering implements IItemRendering
{
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
}
else if( !this.itemModels.isEmpty() || 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( itemColor != null )
{

View File

@ -420,7 +420,8 @@ public final class ApiBlocks implements IBlocks
@SideOnly( Side.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
itemRendering.model( new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, registryName ), "facing=east,half=bottom,shape=straight" ) );
ModelResourceLocation model = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, registryName ), "facing=east,half=bottom,shape=straight" );
itemRendering.model( model );
}
} )
.build();

View File

@ -43,10 +43,10 @@ public class ItemMultipartRendering extends ItemRenderingCustomizer
// Register all item models as variants so they get loaded
rendering.variants( Arrays.stream( PartType.values() )
.filter( f -> f != PartType.InvalidType )
.flatMap( part -> part.getItemModels().stream() )
.collect( Collectors.toList() ) );
// TODO All of this has to go somewhere else! (I.e. when the part is registered)
// Register the built-in models for annihilation planes
ResourceLocation annihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "items/part/annihilation_plane" );
ResourceLocation annihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/annihilation_plane_on" );

View File

@ -0,0 +1,7 @@
{
"variants": {
"normal": {
"model": "appliedenergistics2:matrix_frame"
}
}
}

View File

@ -1,31 +1,7 @@
{
"multipart": [
{
"apply": [{ "model": "appliedenergistics2:quartz_glass_1" }, { "model": "appliedenergistics2:quartz_glass_2" }, { "model": "appliedenergistics2:quartz_glass_3" }, { "model": "appliedenergistics2:quartz_glass_4" }]
},
{
"when": { "down": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame", "x": 90 }
},
{
"when": { "up": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame", "x": -90 }
},
{
"when": { "north": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame"}
},
{
"when": { "south": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame", "y": 180 }
},
{
"when": { "west": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame", "y": -90 }
},
{
"when": { "east": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame", "y": 90 }
"variants": {
"normal": {
"model": "appliedenergistics2:builtin/quartz_glass"
}
]
}
}
}

View File

@ -0,0 +1,3 @@
{
"elements": []
}