Applied-Energistics-2-tiler.../src/main/java/appeng/block/storage/SkyChestRenderingCustomizer.java
Sebastian Hartte 3403e47b02 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
2016-09-10 13:19:21 +02:00

52 lines
1.2 KiB
Java

package appeng.block.storage;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.tesr.SkyChestTESR;
public class SkyChestRenderingCustomizer extends BlockRenderingCustomizer
{
private final BlockSkyChest.SkyChestType type;
public SkyChestRenderingCustomizer( BlockSkyChest.SkyChestType type )
{
this.type = type;
}
@SideOnly( Side.CLIENT )
@Override
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.tesr( new SkyChestTESR() );
// Register a custom non-tesr item model
String modelName = getModelFromType();
ModelResourceLocation model = new ModelResourceLocation( "appliedenergistics2:" + modelName, "inventory" );
itemRendering.model( model ).variants( model );
}
private String getModelFromType()
{
final String modelName;
switch( type )
{
default:
case STONE:
modelName = "sky_stone_chest";
break;
case BLOCK:
modelName = "smooth_sky_stone_chest";
break;
}
return modelName;
}
}