Search in sources :

Example 1 with CreativeBakedModel

use of com.creativemd.creativecore.client.rendering.model.CreativeBakedModel in project A-Little-Extra-Tiles by Doc-1.

the class GuiStack method getTexture.

public String getTexture(ItemStack stack) {
    Block block = Block.getBlockFromItem(stack.getItem());
    Item item = stack.getItem();
    int damage = item.getDamage(stack);
    int meta = item.getMetadata(damage);
    IBlockState state = BlockUtils.getState(block, meta);
    Minecraft minecraft = Minecraft.getMinecraft();
    if (this.useBlock) {
        ResourceLocation reg = block.getRegistryName();
        BlockRendererDispatcher ren = minecraft.getBlockRendererDispatcher();
        texture = ren.getModelForState(state).getQuads(state, facing, 0).get(0).getSprite().toString();
    } else {
        RenderItem itemRen = minecraft.getRenderItem();
        ItemModelMesher mesher = itemRen.getItemModelMesher();
        CreativeBakedModel model;
        texture = mesher.getItemModel(stack).getQuads(null, null, 0).get(0).getSprite().toString();
    // texture =
    // .getQuads(null, null, 0).get(0).getSprite().toString();
    }
    return texture;
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) Item(net.minecraft.item.Item) RenderItem(net.minecraft.client.renderer.RenderItem) IBlockState(net.minecraft.block.state.IBlockState) ItemModelMesher(net.minecraft.client.renderer.ItemModelMesher) ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block) Minecraft(net.minecraft.client.Minecraft) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher) CreativeBakedModel(com.creativemd.creativecore.client.rendering.model.CreativeBakedModel)

Aggregations

CreativeBakedModel (com.creativemd.creativecore.client.rendering.model.CreativeBakedModel)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 Minecraft (net.minecraft.client.Minecraft)1 BlockRendererDispatcher (net.minecraft.client.renderer.BlockRendererDispatcher)1 ItemModelMesher (net.minecraft.client.renderer.ItemModelMesher)1 RenderItem (net.minecraft.client.renderer.RenderItem)1 Item (net.minecraft.item.Item)1 ResourceLocation (net.minecraft.util.ResourceLocation)1