Java 类net.minecraft.client.renderer.ItemModelMesher 实例源码

项目:BaseClient    文件:RenderItem.java   
public RenderItem(TextureManager textureManager, ModelManager modelManager)
{
    this.textureManager = textureManager;
    Config.setModelManager(modelManager);

    if (Reflector.ItemModelMesherForge_Constructor.exists())
    {
        this.itemModelMesher = (ItemModelMesher)Reflector.newInstance(Reflector.ItemModelMesherForge_Constructor, new Object[] {modelManager});
    }
    else
    {
        this.itemModelMesher = new ItemModelMesher(modelManager);
    }

    this.registerItems();
}
项目:StructPro    文件:UItem.java   
/**
 * Resolve item state validity
 * @param meta Item metadata
 * @return Is item state valid
 */
@SuppressWarnings({"ConstantConditions"})
public boolean isValidItemState(int meta) {
    if (!isValid()) {
        return false;
    }
    try {
        ItemModelMesher models = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
        TextureAtlasSprite sprite = models.getParticleIcon(item, meta);
        return sprite != null &&
                sprite.getIconName() != null &&
                !sprite.getIconName().equalsIgnoreCase("") &&
                !sprite.getIconName().equalsIgnoreCase("missingno");
    } catch (Throwable ignored) {
        return false;
    }
}
项目:StructPro    文件:UItem.java   
/**
 * Resolve item state validity
 * @param meta Item metadata
 * @return Is item state valid
 */
@SuppressWarnings({"ConstantConditions"})
public boolean isValidItemState(int meta) {
    if (!isValid()) {
        return false;
    }
    try {
        ItemModelMesher models = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
        TextureAtlasSprite sprite = models.getParticleIcon(item, meta);
        return sprite != null &&
                sprite.getIconName() != null &&
                !sprite.getIconName().equalsIgnoreCase("") &&
                !sprite.getIconName().equalsIgnoreCase("missingno");
    } catch (Throwable ignored) {
        return false;
    }
}
项目:StructPro    文件:UItem.java   
/**
 * Resolve item state validity
 * @param meta Item metadata
 * @return Is item state valid
 */
@SuppressWarnings({"ConstantConditions"})
public boolean isValidItemState(int meta) {
    if (!isValid()) {
        return false;
    }
    try {
        ItemModelMesher models = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
        TextureAtlasSprite sprite = models.getParticleIcon(item, meta);
        return sprite != null &&
                sprite.getIconName() != null &&
                !sprite.getIconName().equalsIgnoreCase("") &&
                !sprite.getIconName().equalsIgnoreCase("missingno");
    } catch (Throwable ignored) {
        return false;
    }
}
项目:Tutorial-1.11    文件:ModItems.java   
/**
 * The client-side initializer. Here we handle model registration. Note the @SideOnly annotation. This causes the
 * method to exist only on the client-side, preventing servers from crashing.
 * 
 * This should be called during init, calling during preInit will crash.
 */
@SideOnly(Side.CLIENT)
public static void initClient(ItemModelMesher mesher) {

  // Create a MRL for the model. Note we have two parameters and the second must be "inventory". We can reuse this
  // variable for each item of course, since most Java variables just contain a reference to an object.
  ModelResourceLocation model = new ModelResourceLocation(
      Tutorial.RESOURCE_PREFIX + Names.TUTORIAL_ITEM, "inventory");
  // Here we list all models the item can possibly have. An array will work, or just list each MRL for the final
  // parameters.
  ModelLoader.registerItemVariants(tutorialItem, model);
  // Finally, we associate each MRL (model) with different metadata values for the item. This must be called for each
  // variant! And even if the variants don't depend on metadata, I believe each variant must be registered to a unique
  // meta... In this case, there are no other variants, so we just pass in a metadata of zero.
  mesher.register(tutorialItem, 0, model);

  registerModel(mesher, tutorialPickaxe, Names.PICKAXE);
}
项目:Factorization    文件:HtmlConversionTypesetter.java   
@Override
public void putItem(ItemStack theItem, String link) {
    String imgType = "item";
    String found_icon;
    if (theItem == null) {
        found_icon = "factorization:transparent_item";
    } else {
        ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
        IBakedModel ibm = mesher.getItemModel(theItem);
        if (ibm == null) {
            found_icon = "error";
        } else {
            found_icon = ibm.getParticleTexture().getIconName();
        }
        if (theItem.getItem() instanceof ItemBlock) {
            imgType = "block";
        }
    }
    html("<img class=\"" + imgType + "\" src=\"" + img(found_icon) + "\" />");
    found_icon = null;
    // TODO (and this is crazy!) render the item to a texture
    // Would be good to do this only if it isn't a standard item texture, maybe.
    // Same mechanism could probably be used for docfigures; maybe make an animated gif? Would be rad.
}
项目:Alloycraft    文件:ClientProxy.java   
public static void render() {
    net.minecraft.client.renderer.color.IItemColor colour = new net.minecraft.client.renderer.color.IItemColor() {
       public int getColorFromItemstack(ItemStack stack, int tintIndex) {
        if (stack.getTagCompound() != null) {
            // Checks to make sure all stats are less than or equal too 255
            if (stack.getTagCompound().getInteger("Strength") <= 255 && stack.getTagCompound().getInteger("Durability") <= 255 && stack.getTagCompound().getInteger("Enchantability") <= 255) {
            return new Color(stack.getTagCompound().getInteger("Strength"), stack.getTagCompound().getInteger("Durability"), stack.getTagCompound().getInteger("Enchantability")).getRGB();
        }
        }
            return new Color(255,255,255).getRGB();
        }
   };
    Minecraft.getMinecraft().getItemColors().registerItemColorHandler(colour, new Item[] {AlloycraftItems.alloy, AlloycraftItems.alloysword, AlloycraftItems.alloyaxe, AlloycraftItems.alloyhoe, AlloycraftItems.alloyshovel, AlloycraftItems.alloypickaxe, AlloycraftItems.alloyhelmet, AlloycraftItems.alloychestplate, AlloycraftItems.alloyleggings, AlloycraftItems.alloyboots});
    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    mesher.register(AlloycraftItems.alloy, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloy", "inventory"));
    mesher.register(AlloycraftItems.alloysword, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloysword", "inventory"));
    mesher.register(AlloycraftItems.alloyaxe, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyaxe", "inventory"));
    mesher.register(AlloycraftItems.alloyhoe, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyhoe", "inventory"));
    mesher.register(AlloycraftItems.alloyshovel, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyshovel", "inventory"));
    mesher.register(AlloycraftItems.alloypickaxe, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloypickaxe", "inventory"));
    mesher.register(AlloycraftItems.alloyhelmet, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyhelm", "inventory"));
    mesher.register(AlloycraftItems.alloychestplate, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloychestplate", "inventory"));
    mesher.register(AlloycraftItems.alloyleggings, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyleggings", "inventory"));
    mesher.register(AlloycraftItems.alloyboots, 0, new net.minecraft.client.renderer.block.model.ModelResourceLocation(AlloycraftMain.modid + ":" + "alloyboots", "inventory"));
}
项目:BucketBlocks    文件:ClientProxy.java   
@Override
public void registerRenderers(){

    // More info on proxy rendering
    // http://www.minecraftforge.net/forum/index.php?topic=27684.0
    // http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2272349-lessons-from-my-first-mc-1-8-mod

    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();

    String name;
    Item item;

    for(Block b : BlockRegistry.blocks){
        item = Item.getItemFromBlock(b);
        name = ModBucketBlocks.TEXTURE_LOCATION + b.getUnlocalizedName().replaceAll("tile.", "");

        mesher.register(item, 0, new ModelResourceLocation(name, "inventory"));
    }
}
项目:GearSwapper1.8    文件:ModBlocks.java   
@SideOnly(Side.CLIENT)
    public static void initModels() {
        woodenGearSwapperBlock.initModel();
        ironGearSwapperBlock.initModel();
        lapisGearSwapperBlock.initModel();
        stoneGearSwapperBlock.initModel();
        glassGearSwapperBlock.initModel();
        if (!Config.customBlockName.isEmpty()) {
            Block b = Block.blockRegistry.getObject(new ResourceLocation(Config.customBlockName));
            if (b != null) {
                ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
                mesher.register(Item.getItemFromBlock(moddedGearSwapperBlock), 0, new ModelResourceLocation(b.getRegistryName(), "inventory"));

//                moddedGearSwapperBlock.initModel();
            }
        }
    }
项目:HorseFood    文件:ClientProxy.java   
@Override
public void registerRenderers(){

    // More info on proxy rendering
    // http://www.minecraftforge.net/forum/index.php?topic=27684.0
    // http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2272349-lessons-from-my-first-mc-1-8-mod

    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();

    String name;
    for(Item i : ItemRegistry.items){
        name = TEXTURE_LOCATION + i.getUnlocalizedName().replaceAll("item.", "");

        mesher.register(i, 0, new ModelResourceLocation(name, "inventory"));
    }
}
项目:wise-plus-mod    文件:ModTextures.java   
public static void registerTextures() {
    ItemModelMesher itemModelMesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();

    // Items
    registerItem(itemModelMesher, ModItems.TITANIUM_AXE);
    registerItem(itemModelMesher, ModItems.TITANIUM_BOOTS);
    registerItem(itemModelMesher, ModItems.TITANIUM_CHESTPLATE);
    registerItem(itemModelMesher, ModItems.TITANIUM_HELMET);
    registerItem(itemModelMesher, ModItems.TITANIUM_HOE);
    registerItem(itemModelMesher, ModItems.TITANIUM_HORSE_ARMOR);
    registerItem(itemModelMesher, ModItems.TITANIUM_INGOT);
    registerItem(itemModelMesher, ModItems.TITANIUM_LEGGINGS);
    registerItem(itemModelMesher, ModItems.TITANIUM_PICKAXE);
    registerItem(itemModelMesher, ModItems.TITANIUM_SHOVEL);
    registerItem(itemModelMesher, ModItems.TITANIUM_SWORD);

    // Blocks
    registerBlock(itemModelMesher, ModBlocks.TITANIUM_ORE);
    registerBlock(itemModelMesher, ModBlocks.TITANIUM_BLOCK);
}
项目:enderutilities    文件:ModelNullifierBaked.java   
@SuppressWarnings("unchecked")
private void reflectMaps()
{
    if (LOCATIONS == null || SHAPERS == null)
    {
        try
        {
            ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();

            Field locs = ReflectionHelper.findField(ItemModelMesherForge.class, "locations");
            LOCATIONS = (Map<IRegistryDelegate<Item>, TIntObjectHashMap<ModelResourceLocation>>) locs.get(mesher);

            Field shapers = ReflectionHelper.findField(ItemModelMesher.class, "field_178092_c", "shapers");
            SHAPERS = (Map<Item, ItemMeshDefinition>) shapers.get(mesher);

            Field models = ReflectionHelper.findField(ModelLoader.class, "stateModels");
            STATE_MODELS = (Map<ModelResourceLocation, IModel>) models.get(MODEL_LOADER);
        }
        catch (Exception e)
        {
            EnderUtilities.logger.warn("ModelNullifierBaked: Failed to reflect model maps", e);
        }
    }
}
项目:SamsPowerups    文件:ClientProxy.java   
private void registerModels() 
{
    //More info on proxy rendering
       //http://www.minecraftforge.net/forum/index.php?topic=27684.0
      //http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2272349-lessons-from-my-first-mc-1-8-mod

       ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();

       String name;

       for(Item i : ItemRegistry.items)
       {  
        name = ModSpells.TEXTURE_LOCATION + i.getUnlocalizedName().replaceAll("item.", "");

            mesher.register(i, 0, new ModelResourceLocation( name , "inventory"));   
       }
       /*
       if(ModMain.cfg.respawn_egg)
       {
        for(Object key : EntityList.entityEggs.keySet())
           {
            mesher.register(ItemRegistry.respawn_egg, (Integer)key, new ModelResourceLocation(ModSpells.TEXTURE_LOCATION + "respawn_egg" , "inventory"));    
           }
       }
      */ 
}
项目:SamsPowerups    文件:ClientProxy.java   
@Override
   public void registerRenderers() 
   {  

    //More info on proxy rendering
       //http://www.minecraftforge.net/forum/index.php?topic=27684.0
      //http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2272349-lessons-from-my-first-mc-1-8-mod

       ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();

       String name;


       for(Item i : ItemRegistry.items)
       {  
        name = ModArmor.TEXTURE_LOCATION + i.getUnlocalizedName().replaceAll("item.", "");

            mesher.register(i, 0, new ModelResourceLocation( name , "inventory"));   
       } 
}
项目:SamsPowerups    文件:ClientProxy.java   
@Override
   public void registerRenderers() 
   {  
    //More info on proxy rendering
       //http://www.minecraftforge.net/forum/index.php?topic=27684.0
      //http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2272349-lessons-from-my-first-mc-1-8-mod

       ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();

       String name;
       Item item;

       for(Block b : BlockRegistry.blocks)
       { 
        item = Item.getItemFromBlock(b);
        name = ModFarmingBlocks.TEXTURE_LOCATION + b.getUnlocalizedName().replaceAll("tile.", "");

            mesher.register(item, 0, new ModelResourceLocation( name , "inventory"));    
       } 
}
项目:Combustible-Lemon-Launcher    文件:ClientProxy.java   
@Override
public void initializeRenderers(){
    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    mesher.register(Item.getItemFromBlock(blockLemonTreePlanks), 0, new ModelResourceLocation(MOD_ID + ":" + BLOCK_LEMON_TREE_PLANKS, "inventory"));
    mesher.register(Item.getItemFromBlock(blockLemonTreeLog), 0, new ModelResourceLocation(MOD_ID + ":" + BLOCK_LEMON_TREE_LOG, "inventory"));
    mesher.register(Item.getItemFromBlock(blockLemonLeavesHarvested), 0, new ModelResourceLocation(MOD_ID + ":" + BLOCK_LEMON_LEAVES_HARVESTED, "inventory"));
    mesher.register(Item.getItemFromBlock(blockLemonLeaves), 0, new ModelResourceLocation(MOD_ID + ":" + BLOCK_LEMON_LEAVES, "inventory"));
    mesher.register(Item.getItemFromBlock(blockLemonTreeSapling), 0, new ModelResourceLocation(MOD_ID + ":" + BLOCK_LEMON_TREE_SAPLING, "inventory"));

    mesher.register(itemLemon, 0, new ModelResourceLocation(MOD_ID + ":" + ITEM_LEMON, "inventory"));
    mesher.register(itemLemonExplosive, 0, new ModelResourceLocation(MOD_ID + ":" + ITEM_LEMON_EXPLOSIVE, "inventory"));
    mesher.register(itemCombustibleLemonLauncher, 0, new ModelResourceLocation(MOD_ID + ":" + ITEM_COMBUSTIBLE_LEMON_LAUNCHER.toLowerCase(), "inventory"));

    MinecraftForge.EVENT_BUS.register(new HoldLikeBowHook());
    MinecraftForge.EVENT_BUS.register(new CLLConfig());
}
项目:OpenModsLib    文件:GuiComponentItemStackSpinner.java   
private void renderItem(ItemStack itemStack) {
    parent.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

    final RenderItem itemRenderer = parent.getItemRenderer();
    final ItemModelMesher itemModelMesher = itemRenderer.getItemModelMesher();
    final IBakedModel model = itemModelMesher.getItemModel(stack);

    GlStateManager.disableLighting();
    GlStateManager.enableRescaleNormal();
    GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
    GlStateManager.pushMatrix();
    itemRenderer.renderItem(stack, model);
    GlStateManager.cullFace(CullFace.BACK);
    GlStateManager.popMatrix();
    GlStateManager.disableRescaleNormal();
    GlStateManager.disableBlend();

    GlStateManager.enableLighting();
}
项目:OpenFlexiTrack    文件:OFTRegistryClient.java   
/**
 * Called during Forge's main initialisation stage to register item models.
 */
public static void init(){
    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    mesher.register(OFTRegistry.ties, 0, new ModelResourceLocation(OFT.MODID + ":" + "ties", "inventory"));
    mesher.register(OFTRegistry.rails, 0, new ModelResourceLocation(OFT.MODID + ":" + "rails", "inventory"));
    mesher.register(OFTRegistry.track, 0, new ModelResourceLocation(OFT.MODID + ":" + "track", "inventory"));
    mesher.register(Item.getItemFromBlock(OFTRegistry.surveyFlag), 0, new ModelResourceLocation(OFT.MODID + ":" + "surveyflag", "inventory"));
}
项目:Possessed    文件:ClientProxy.java   
@Override
public void onPostInit() {
    super.onPostInit();
    ItemModelMesher modelMesher = ClientProxy.MINECRAFT.getRenderItem().getItemModelMesher();
    modelMesher.register(ItemRegistry.POSSESSIVE_HELMET, stack -> new ModelResourceLocation(Possessed.MODID + ":possessive_helmet", "inventory"));
    modelMesher.register(ItemRegistry.POSSESSITITE, stack -> new ModelResourceLocation(Possessed.MODID + ":possessitite", "inventory"));
    modelMesher.register(Item.getItemFromBlock(BlockRegistry.POSSESSITITE_ORE), stack -> new ModelResourceLocation(Possessed.MODID + ":possessitite_ore", "inventory"));
}
项目:Tutorial-1.11    文件:ModBlocks.java   
/**
 * The client-side initializer. Here we handle model registration. Don't forget the @SideOnly annotation! This should
 * be called during init.
 */
@SideOnly(Side.CLIENT)
public static void initClient(ItemModelMesher mesher) {

  // We can only register models for Items, so get the item for the block. Maybe you could save a reference to the
  // ItemBlock in init? I haven't tried it, but we likely wouldn't use it anywhere else, so it's not worth doing.
  Item item = Item.getItemFromBlock(tutorialBlock);
  // Everything past this point is identical to registering models for items.
  ModelResourceLocation model = new ModelResourceLocation(
      Tutorial.RESOURCE_PREFIX + Names.TUTORIAL_BLOCK, "inventory");
  ModelLoader.registerItemVariants(item, model);
  mesher.register(item, 0, model);
}
项目:Tutorial-1.11    文件:ClientProxy.java   
@Override
public void init(FMLInitializationEvent event) {

  super.init(event);

  ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();

  // Register block models
  ModBlocks.initClient(mesher);
  // Register item models
  ModItems.initClient(mesher);
}
项目:ExoMagica    文件:ClientProxy.java   
@Override
protected void registerItem(Item item, String id) {
    super.registerItem(item, id);

    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    ModelResourceLocation loc = new ModelResourceLocation(item.getRegistryName(), "inventory");
    List<ItemStack> items = new ArrayList<ItemStack>();
    item.getSubItems(item, null, items);
    for(ItemStack stack : items) {
        mesher.register(item, stack.getMetadata(), loc);
    }
}
项目:ExoMagica    文件:ClientProxy.java   
@Override
protected void registerBlock(Block block, ItemBlock itemBlock, String id) {
    super.registerBlock(block, itemBlock, id);

    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    Item item = Item.getItemFromBlock(block);
    ModelResourceLocation loc = new ModelResourceLocation(block.getRegistryName(), "inventory");
    List<ItemStack> items = new ArrayList<ItemStack>();
    block.getSubBlocks(item, null, items);
    for(ItemStack stack : items) {
        mesher.register(item, stack.getMetadata(), loc);
    }
}
项目:DungeonDimension    文件:ClientProxy.java   
@Override
public void init() {
    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    mesher.register(DungeonDimension.creativetp, 0, new ModelResourceLocation(References.MODID + ":creativetp", "inventory"));
    mesher.register(DungeonDimension.corruptionslime, 0, new ModelResourceLocation(References.MODID + ":corruptionslime", "inventory"));
    mesher.register(Item.getItemFromBlock(DungeonDimension.corruption), 0, new ModelResourceLocation(References.MODID + ":corruptionblock", "inventory"));
    mesher.register(Item.getItemFromBlock(DungeonDimension.monumentteleporter), 0, new ModelResourceLocation(References.MODID + ":monumentteleporter", "inventory"));
    mesher.register(Item.getItemFromBlock(DungeonDimension.monumentteleporterbroken), 0, new ModelResourceLocation(References.MODID + ":monumentteleporterbroken", "inventory"));
}
项目:Factorization    文件:RenderUtil.java   
public static TextureAtlasSprite getSprite(ItemStack log) {
    Minecraft mc = Minecraft.getMinecraft();
    Block b = DataUtil.getBlock(log);
    if (b == null) {
        ItemModelMesher itemModelMesher = mc.getRenderItem().getItemModelMesher();
        if (log == null) return itemModelMesher.getItemModel(null).getParticleTexture();
        return itemModelMesher.getParticleIcon(log.getItem());
    }
    IBlockState bs = b.getStateFromMeta(log.getItemDamage());
    return mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(bs);
}
项目:TaleCraft    文件:ClientRenderer.java   
public void init() {
    // Get the ModelMesher and register ALL item-models
    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();

    init_render_item(mesher);
    init_render_block(mesher);

    init_render_entity();
    init_render_tilentity();
}
项目:TaleCraft    文件:ClientRenderer.java   
private void init_render_item(ItemModelMesher mesher) {
    // items

    for(Item item : TaleCraftItems.ALL_TC_ITEMS){
        if(!(item instanceof ItemBlock))mesher.register(item, 0, new ModelResourceLocation("talecraft:" + item.getUnlocalizedName().replace("item.", ""), "inventory"));
    }
}
项目:Alloycraft    文件:AlloycraftBlocks.java   
public static void initBlocks() {

    GameRegistry.register(forgeoff, new ResourceLocation(AlloycraftMain.modid, "forgeoff"));
    GameRegistry.register(new ItemBlock(forgeoff), new ResourceLocation(AlloycraftMain.modid, "forgeoff"));
    GameRegistry.registerTileEntity(ForgeTileEntity.class, "forgefurnace");
    if (Loader.isModLoaded("Tesla")) {
        GameRegistry.register(forgeteslaoff, new ResourceLocation(AlloycraftMain.modid, "forgeteslaoff"));
        GameRegistry.register(new ItemBlock(forgeteslaoff), new ResourceLocation(AlloycraftMain.modid, "forgeteslaoff"));
        GameRegistry.registerTileEntity(ForgeTeslaTileEntity.class, "forgeteslafurnace");
    }
    if(FMLCommonHandler.instance().getSide() == Side.CLIENT) {
        ItemModelMesher itemRender = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
        itemRender.register(Item.getItemFromBlock(AlloycraftBlocks.forgeoff), 0, new ModelResourceLocation(AlloycraftMain.modid + ":" + "forgeoff", "inventory"));
        if (Loader.isModLoaded("Tesla")) {
            itemRender.register(Item.getItemFromBlock(AlloycraftBlocks.forgeteslaoff), 0, new ModelResourceLocation(AlloycraftMain.modid + ":" + "forgeoff", "inventory"));
        }   
    }
    GameRegistry.addRecipe(new ItemStack(forgeoff, 1), new Object[]{
            "AAA",
            "ABA",
            "DCD",
            'A', Items.IRON_INGOT, 'B', Blocks.IRON_BLOCK, 'C', Blocks.REDSTONE_BLOCK, 'D', Blocks.FURNACE
        });
    GameRegistry.addRecipe(new ItemStack(forgeteslaoff, 1), new Object[]{
            "AAA",
            "ACA",
            "DBD",
            'A', Items.IRON_INGOT, 'B', Blocks.IRON_BLOCK, 'C', Blocks.REDSTONE_BLOCK, 'D', Blocks.FURNACE
        });

}
项目:BiomeWand    文件:ClientProxy.java   
@Override
public void init()
{
    RenderItem ri = Minecraft.getMinecraft().getRenderItem();
    ItemModelMesher imm = ri.getItemModelMesher();

    imm.register( BiomeWandMod.items.wand, 0, new ModelResourceLocation( "sc0_biomewand:wand", "inventory" ) );
    imm.register( BiomeWandMod.items.sample, 0, new ModelResourceLocation( "sc0_biomewand:sample", "inventory" ) );

    MinecraftForge.EVENT_BUS.register( this );
}
项目:CivCraft    文件:ItemTechnology.java   
@Override
public void initModel() {
    String mesherName = CivCraft.instance.meta.modId + ":" + name + "_";
    String[] names = new String[] { mesherName + "none", mesherName + "some", mesherName + "all" };
    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    for (int i = 0; i < 3; i++)
        mesher.register(this, i, new ModelResourceLocation(names[i], "inventory"));
    ModelBakery.addVariantName(this, names);
}
项目:Bookshelf    文件:RenderUtils.java   
/**
 * Gets the TextureAtlasSprite for the ItemStack. Has support for both Items and Blocks.
 *
 * @param stack The ItemStack to get the sprite for.
 * @return The sprite for the ItemStack.
 */
public static TextureAtlasSprite getSprite (ItemStack stack) {

    final Minecraft mc = Minecraft.getMinecraft();
    final Block block = StackUtils.getBlockFromStack(stack);

    if (block == null) {

        final ItemModelMesher mesher = mc.getRenderItem().getItemModelMesher();
        return !stack.isEmpty() ? mesher.getParticleIcon(stack.getItem(), stack.getItemDamage()) : mesher.getItemModel(null).getParticleTexture();
    }

    return mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(block.getStateFromMeta(stack.getItemDamage()));
}
项目:Skree    文件:CustomItemSystem.java   
@SuppressWarnings("unused")
private void render(Object item) {
  if (item instanceof Item && item instanceof ICustomItem) {
    if (Sponge.getPlatform().getExecutionType().isClient()) {
      RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
      ItemModelMesher mesher = renderItem.getItemModelMesher();

      Optional<ItemMeshDefinition> optMeshDefinition = ((ICustomItem) item).__getCustomMeshDefinition();
      if (optMeshDefinition.isPresent()) {
        mesher.register((Item) item, optMeshDefinition.get());
      }

      List<String> variants = ((ICustomItem) item).__getMeshDefinitions();
      List<ResourceLocation> modelResources = new ArrayList<>();

      for (int i = 0; i < variants.size(); ++i) {
        ModelResourceLocation resourceLocation = new ModelResourceLocation(
            "skree:" + variants.get(i),
            "inventory"
        );

        if (!optMeshDefinition.isPresent()) {
          mesher.register((Item) item, i, resourceLocation);
        }
        modelResources.add(resourceLocation);
      }

      ModelBakery.registerItemVariants(
          (Item) item,
          modelResources.toArray(new ResourceLocation[modelResources.size()])
      );
    }
  } else {
    throw new IllegalArgumentException("Invalid custom item!");
  }
}
项目:Skree    文件:GameIntegrator.java   
private void registerItemRendering(ItemDescriptor descriptor) {
  Item item = descriptor.item;
  ItemConfig config = descriptor.config;

  RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
  ItemModelMesher mesher = renderItem.getItemModelMesher();

  // TODO Custom mesher currently not supported
  // Optional<ItemMeshDefinition> optMeshDefinition = (item).__getCustomMeshDefinition();
  // if (optMeshDefinition.isPresent()) {
  //     mesher.register((Item) item, optMeshDefinition.get());
  // }

  List<String> variants = config.getMeshDefinitions();
  List<ResourceLocation> modelResources = new ArrayList<>();

  for (int i = 0; i < variants.size(); ++i) {
    ModelResourceLocation resourceLocation = new ModelResourceLocation(
        modID + ":" + variants.get(i),
        "inventory"
    );

    // if (!optMeshDefinition.isPresent()) {
    mesher.register(item, i, resourceLocation);
    // }
    modelResources.add(resourceLocation);
  }

  ModelBakery.registerItemVariants(item, modelResources.toArray(new ResourceLocation[modelResources.size()]));
}
项目:FutureCraft    文件:StartupClientOnly.java   
private static void registerMetaItemRendering(String name, String... modelNames) {
    Item item = GameRegistry.findItem(FutureCraft.MODID, name);
    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    String[] newModelNames = new String[modelNames.length];
    for (int i = 0; i < modelNames.length; i++) {
        newModelNames[i] = FutureCraft.MODID + ":" + modelNames[i];
    }

    ModelBakery.addVariantName(item, newModelNames);

    for (int i = 0; i < modelNames.length; i++) {
        mesher.register(item, i, new ModelResourceLocation(FutureCraft.MODID + ":" + modelNames[i], "inventory"));
    }
}
项目:SurvivalCommandBlocks    文件:ClientProxy.java   
@Override
public void registerRenderers() 
   {  
    String item;
       ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
        for(int i = 0; i < BlockRegistry.delay.size(); i++)
        {
            item = ModSurvCommand.TEXTURE_LOCATION + BlockRegistry.delayNames.get(i); 
            mesher.register(BlockRegistry.delay.get(i), 0, new ModelResourceLocation( item , "inventory"));                 
        } 
   }
项目:SurvivalWings    文件:ClientProxy.java   
@Override
public void init()
{
    RenderItem ri = Minecraft.getMinecraft().getRenderItem();
    ItemModelMesher imm = ri.getItemModelMesher();

    imm.register( Wings.items.featherWings,  0, new ModelResourceLocation( "sc0_wings:featherWings",  "inventory" ) );
    imm.register( Wings.items.obsidianWings, 0, new ModelResourceLocation( "sc0_wings:obsidianWings", "inventory" ) );
    imm.register( Wings.items.sturdyWings,   0, new ModelResourceLocation( "sc0_wings:sturdyWings",   "inventory" ) );
    imm.register( Wings.items.fastWings,     0, new ModelResourceLocation( "sc0_wings:fastWings",     "inventory" ) );
}
项目:taam    文件:TaamClientProxy.java   
/**
 * Registers & remembers a model location for inventory rendering for the
 * given item, for a single meta value.
 *
 * Specific for items using OBJ models.
 *
 * @param modelMesher
 * @param itemId
 * @param metaValue
 * @param modelFile
 */
private void registerItemOBJSingleMeta(ItemModelMesher modelMesher, String itemId, int metaValue, String modelFile) {
    // Find item to register
    Item item = GameRegistry.findItem(Taam.MOD_ID, itemId);

    // Create & remember model location
    final ModelResourceLocation resourceLocation = new ModelResourceLocation(Taam.MOD_ID + ":" + modelFile, "inventory");
    locationsToReplace.add(resourceLocation);

    // Register the variant
    modelMesher.register(item, metaValue, resourceLocation);
    // Register the model location
    ModelLoader.setCustomModelResourceLocation(item, metaValue, resourceLocation);
}
项目:vintagecraft    文件:TESRStonePot.java   
void renderItemStack(ItemStack itemstack, EntityPlayer player, ItemCameraTransforms.TransformType cameraTransformType, ResourceLocation texture, int color) {
    ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    IBakedModel ibakedmodel = mesher.getItemModel(itemstack);

    TextureManager textureManager = Minecraft.getMinecraft().renderEngine;

       textureManager.bindTexture(texture);
       //textureManager.getTexture(texture).setBlurMipmap(false, false);


       GL11.glTranslatef(-0.5f, -0.5f, -0.5f);

       Tessellator tessellator = Tessellator.getInstance();
       WorldRenderer worldrenderer = tessellator.getWorldRenderer();
       worldrenderer.startDrawingQuads();
       worldrenderer.setVertexFormat(DefaultVertexFormats.ITEM);
       EnumFacing[] aenumfacing = EnumFacing.values();
       int j = aenumfacing.length;

       for (int k = 0; k < j; ++k) {
           EnumFacing enumfacing = aenumfacing[k];
           renderQuads(worldrenderer, ibakedmodel.getFaceQuads(enumfacing), itemstack, 1, color);
       }

       renderQuads(worldrenderer, ibakedmodel.getGeneralQuads(), itemstack, 1, color);
       tessellator.draw();



       //textureManager.bindTexture(texture);
       //textureManager.getTexture(texture).restoreLastBlurMipmap();
}
项目:Floocraft    文件:ClientProxy.java   
@Override
public void registerModels()
{
    //Describes how some blocks should look in the inventory
    ItemModelMesher m = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    m.register(FloocraftBase.itemFlooSign, 0, new ModelResourceLocation(DataReference.MODID + ":itemfloosign", "inventory"));
    m.register(Item.getItemFromBlock(FloocraftBase.blockFlooTorch), 0, new ModelResourceLocation(DataReference.MODID + ":flootorch", "inventory"));
    m.register(Item.getItemFromBlock(FloocraftBase.floowerPot), 0, new ModelResourceLocation(DataReference.MODID + ":floowerpot", "inventory"));
    m.register(FloocraftBase.floopowder1t, 0, new ModelResourceLocation(DataReference.MODID + ":floopowder_one", "inventory"));
    m.register(FloocraftBase.floopowder2t, 0, new ModelResourceLocation(DataReference.MODID + ":floopowder_two", "inventory"));
    m.register(FloocraftBase.floopowder4t, 0, new ModelResourceLocation(DataReference.MODID + ":floopowder_four", "inventory"));
    m.register(FloocraftBase.floopowder8t, 0, new ModelResourceLocation(DataReference.MODID + ":floopowder_eight", "inventory"));
    m.register(FloocraftBase.floopowderc, 0, new ModelResourceLocation(DataReference.MODID + ":floopowder_infinite", "inventory"));
}
项目:Crying-Obsidian    文件:ClientProxy.java   
@Override
public void registerModels() {

    final ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
    mesher.register(Item.getItemFromBlock(CryingObsidian.cryingObsidianBlock), 0, new ModelResourceLocation(Utils.ID + ":crying_obsidian_block", "inventory"));
    mesher.register(Item.getItemFromBlock(CryingObsidian.cryingObsidianBlockDecoration), 0, new ModelResourceLocation(Utils.ID + ":crying_obsidian_block_decoration", "inventory"));
    mesher.register(Item.getItemFromBlock(CryingObsidian.cryingObsidianBlockAdvanced), 0, new ModelResourceLocation(Utils.ID + ":crying_obsidian_block_advanced", "inventory"));
    mesher.register(CryingObsidian.cryingObsidianItem, 0, new ModelResourceLocation(Utils.ID + ":crying_obsidian_item", "inventory"));

}