c6b9926d7f
Added a way to register built-in models to support this.
78 lines
2.2 KiB
Java
78 lines
2.2 KiB
Java
package appeng.bootstrap;
|
|
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
|
|
import net.minecraft.client.renderer.ItemMeshDefinition;
|
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|
import net.minecraft.client.renderer.color.IItemColor;
|
|
import net.minecraft.util.ResourceLocation;
|
|
import net.minecraftforge.client.model.IModel;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
|
|
/**
|
|
* Allows the rendering of an item to be customized.
|
|
*/
|
|
public interface IItemRendering
|
|
{
|
|
|
|
/**
|
|
* Registers a custom item mesh definition that will be used to dynamically determine the
|
|
* item model to be used for rendering by inspecting the item stack (i.e. for NBT data).
|
|
* Please
|
|
*/
|
|
@SideOnly( Side.CLIENT )
|
|
IItemRendering meshDefinition( ItemMeshDefinition meshDefinition );
|
|
|
|
/**
|
|
* Registers an item model for meta=0, see {@link #model(int, ModelResourceLocation)}.
|
|
*/
|
|
@SideOnly( Side.CLIENT )
|
|
default IItemRendering model( ModelResourceLocation model )
|
|
{
|
|
return model( 0, model );
|
|
}
|
|
|
|
/**
|
|
* Registers an item model for a given meta.
|
|
*/
|
|
@SideOnly( Side.CLIENT )
|
|
IItemRendering model( int meta, ModelResourceLocation model );
|
|
|
|
/**
|
|
* Convenient override for {@link #variants(Collection)}.
|
|
*/
|
|
@SideOnly( Side.CLIENT )
|
|
default IItemRendering variants( ResourceLocation... resources )
|
|
{
|
|
return variants( Arrays.asList( resources ) );
|
|
}
|
|
|
|
/**
|
|
* Registers the item variants of this item. This are all models that need to be loaded for this item.
|
|
* This has no direct effect on rendering, but is used to load models that are used for example by
|
|
* the ItemMeshDefinition.
|
|
*
|
|
* Models registered via {@link #model(int, ModelResourceLocation)} are automatically added here.
|
|
*/
|
|
@SideOnly( Side.CLIENT )
|
|
IItemRendering variants( Collection<ResourceLocation> resources );
|
|
|
|
/**
|
|
* Registers a custom item color definition that inspects an item stack and tint and
|
|
* returns a color multiplier.
|
|
*/
|
|
@SideOnly( Side.CLIENT )
|
|
IItemRendering color( IItemColor itemColor );
|
|
|
|
/**
|
|
* Registers a built-in model under the given resource path.
|
|
*/
|
|
@SideOnly( Side.CLIENT )
|
|
IItemRendering builtInModel( String name, IModel model );
|
|
|
|
}
|