Java 类net.minecraft.client.renderer.block.model.ModelResourceLocation 实例源码

项目:rezolve    文件:ItemBase.java   
public void registerRenderer() {

    ArrayList<ItemStack> subtypes = new ArrayList<ItemStack>();
    this.getSubItems(this, this.getCreativeTab(), subtypes);

    for (ItemStack subtype : subtypes) {
        String unlocalizedName = this.getUnlocalizedName(subtype);
        String modelName = unlocalizedName.replace("item.", "");

        System.out.println("Registering "+this.getRegistryName()+" metadata "+subtype.getMetadata()+" as model "+modelName);
        ModelLoader.setCustomModelResourceLocation(
            this, subtype.getMetadata(), 
            new ModelResourceLocation(modelName, "inventory")
        );
    }

    //Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
    //  .register(this, 0, new ModelResourceLocation(this.getRegistryName().toString(), "inventory"));
}
项目:Never-Enough-Currency    文件:ClientProxy.java   
@Override
public void registerItemRenderer(Item i, int meta, String id) {
    ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(ModInfo.MODID + ":" + id, "inventory"));
}
项目:CustomWorldGen    文件:MultiLayerModel.java   
@Override
public MultiLayerModel process(ImmutableMap<String, String> customData)
{
    ImmutableMap.Builder<Optional<BlockRenderLayer>, ModelResourceLocation> builder = ImmutableMap.builder();
    for(String key : customData.keySet())
    {
        if("base".equals(key))
        {
            builder.put(Optional.<BlockRenderLayer>absent(), getLocation(customData.get(key)));
        }
        for(BlockRenderLayer layer : BlockRenderLayer.values())
        {
            if(layer.toString().equals(key))
            {
                builder.put(Optional.of(layer), getLocation(customData.get(key)));
            }
        }
    }
    ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models = builder.build();
    if(models.isEmpty()) return INSTANCE;
    return new MultiLayerModel(models);
}
项目:Geolosys    文件:ClientRegistry.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void handleModels(ModelRegistryEvent event)
{
    for (Map.Entry<ItemStack, ModelResourceLocation> entry : LOCATIONS.entrySet())
    {
        ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue());
    }
}
项目:CustomWorldGen    文件:ItemModelMesherForge.java   
public void register(Item item, int meta, ModelResourceLocation location)
{
    TIntObjectHashMap<ModelResourceLocation> locs = locations.get(item);
    TIntObjectHashMap<IBakedModel>           mods = models.get(item);
    if (locs == null)
    {
        locs = new TIntObjectHashMap<ModelResourceLocation>();
        locations.put(item, locs);
    }
    if (mods == null)
    {
        mods = new TIntObjectHashMap<IBakedModel>();
        models.put(item, mods);
    }
    locs.put(meta, location);
    mods.put(meta, getModelManager().getModel(location));
}
项目:modName    文件:IHasModel.java   
default public void initModel(ModelRegistryEvent e) 
{
    System.out.println(((IForgeRegistryEntry<?>) this).getRegistryName());
    if (this instanceof Item)
        ModelLoader.setCustomModelResourceLocation((Item) this, 0,
                new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory"));
    else if (this instanceof Block)
    {
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock((Block) this), 0,
                new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory"));
        System.out.println("block");
    }
    else
        throw new IllegalArgumentException("No/invalid object for model");
}
项目:ExPetrum    文件:ClientRegistry.java   
public static void mkCustomModelResourceLocations(Item item, int amount, Function<Integer, String> ptrFunc)
{
    for (int i = 0; i < amount; i++)
    {
        ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(item.getRegistryName(), ptrFunc == null ? "inventory" : ptrFunc.apply(i)));
    }
}
项目:Firma    文件:BaseBlock.java   
public void registerRender() {
    int i = 0;
    Item item = Item.getItemFromBlock(this);
    ResourceLocation[] list = new ResourceLocation[getVariantNames().size()];
    for (String s : getVariantNames()) {

        String loc = this.getRegistryName().toString();// +"#variants="+s;
        ResourceLocation res = new ResourceLocation(loc);
        ModelResourceLocation mrl = new ModelResourceLocation(loc, "variants=" + s);
        ModelLoader.setCustomModelResourceLocation(item, i, mrl);
        list[i] = res;
        i++;
    }
    ModelBakery.registerItemVariants(Item.getItemFromBlock(this), list);
}
项目:BetterBeginningsReborn    文件:RegisterModels.java   
public static <BBBlock extends Block & IBBName> void registerBlock(BBBlock block)
{
    Item item = Item.getItemFromBlock(block);
    if(item != null)
    {
        if(item instanceof ISpecialRender)
        ((ISpecialRender) item).registerRender();
        else
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
    }
}
项目:CustomWorldGen    文件:ModelLoader.java   
private void setBucketModel(Item item)
{
    for(String s : getVariantNames(item))
    {
        ModelResourceLocation memory = getInventoryVariant(s);
        IModel model = stateModels.get(ModelDynBucket.LOCATION);
        if(model != null)
        {
            stateModels.put(memory, model);
        }
    }
}
项目:Polearms    文件:ItemRenderRegister.java   
public static void registerItemRenderer() {
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
            .register(ModItems.woodSpear.getItem(), 0, new ModelResourceLocation("polearms:woodSpear", "inventory"));
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
            .register(ModItems.stoneSpear.getItem(), 0, new ModelResourceLocation("polearms:stoneSpear", "inventory"));
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
            .register(ModItems.ironSpear.getItem(), 0, new ModelResourceLocation("polearms:ironSpear", "inventory"));
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
            .register(ModItems.goldSpear.getItem(), 0, new ModelResourceLocation("polearms:goldSpear", "inventory"));
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
            .register(ModItems.diamondSpear.getItem(), 0, new ModelResourceLocation("polearms:diamondSpear", "inventory"));
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
            .register(ModItems.pole.getItem(), 0, new ModelResourceLocation("polearms:pole", "inventory"));
}
项目:Bewitchment    文件:ModelHandler.java   
public static <T extends Enum<T> & IStringSerializable> void registerModel(Item item, Class<T> clazz) {
    for (T t : clazz.getEnumConstants()) {
        ResourceLocation location = new ResourceLocation(item.getRegistryName() + "_" + t.getName());
        ModelResourceLocation modelResourceLocation = new ModelResourceLocation(location, "inventory");
        ModelLoader.setCustomModelResourceLocation(item, t.ordinal(), modelResourceLocation);
    }
}
项目:Melodium    文件:ItemCompositionPaper.java   
@SideOnly(Side.CLIENT)
@Override
public void initModel(){
    ModelBakery.registerItemVariants(this, new ModelResourceLocation(Melodium.MODID+":composition_paper"), new ModelResourceLocation(Melodium.MODID+":song_paper"));
    ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition(){
        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            if (isLearned(stack)){
                return new ModelResourceLocation(Melodium.MODID+":song_paper");
            }
            return new ModelResourceLocation(Melodium.MODID+":composition_paper");
        }
    });
}
项目:Bewitchment    文件:ItemRitualChalk.java   
@Override
public void registerModel() {
    for (int meta = 0; meta < 4; meta++) {
        ResourceLocation rl = new ResourceLocation(getRegistryName() + "_" + BlockCircleGlyph.GlyphType.values()[meta].name().toLowerCase());
        ModelResourceLocation mrl = new ModelResourceLocation(rl, "inventory");
        ModelLoader.setCustomModelResourceLocation(this, meta, mrl);
    }
}
项目:FoodCraft-Reloaded    文件:EnumLoader.java   
@SideOnly(Side.CLIENT)
protected void registerFluidRender(BlockFluidBase blockFluid, String blockStateName) {
    final String location = FoodCraftReloaded.MODID + ":" + blockStateName;
    final Item itemFluid = Item.getItemFromBlock(blockFluid);
    ModelLoader.setCustomMeshDefinition(itemFluid, stack -> new ModelResourceLocation(location, "fluid"));
    ModelLoader.setCustomStateMapper(blockFluid, new StateMapperBase() {
        @Nonnull
        @Override
        protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) {
            return new ModelResourceLocation(location, "fluid");
        }
    });
}
项目:harshencastle    文件:HarshenBlocks.java   
public static void regRender(Block block) {
    block.setCreativeTab(HarshenCastle.harshenTab);
    int timesToLoad = 1;
    boolean flag = blockDataMap.keySet().contains(block);
    if(flag)
        timesToLoad = blockDataMap.get(block);
    for(int i = 0; i < timesToLoad; i++)
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), i, new ModelResourceLocation(block.getRegistryName() + 
                (flag ? "." + ((IMetaItemBlock)block).getNames()[i]: ""), "inventory"));
}
项目:GeneralLaymansAestheticSpyingScreen    文件:EventHandlerClient.java   
@SubscribeEvent
public void onModelRegistry(ModelRegistryEvent event)
{
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GeneralLaymansAestheticSpyingScreen.blockGlass), 0, new ModelResourceLocation("generallaymansaestheticspyingscreen:block_glass", "inventory"));
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GeneralLaymansAestheticSpyingScreen.blockGlass), 1, new ModelResourceLocation("generallaymansaestheticspyingscreen:block_glass_projector", "inventory"));
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GeneralLaymansAestheticSpyingScreen.blockGlass), 2, new ModelResourceLocation("generallaymansaestheticspyingscreen:block_glass", "inventory"));

    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GeneralLaymansAestheticSpyingScreen.blockGlassTerminal), 0, new ModelResourceLocation("generallaymansaestheticspyingscreen:block_glass_terminal", "inventory"));
}
项目:UniversalRemote    文件:ItemUniversalRemote.java   
@Override
public void register(ModelRegistryEvent event) {

    // register the models
    ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(this.getRegistryName(), "inventory"));
    ModelLoader.setCustomModelResourceLocation(this, 1, new ModelResourceLocation(this.getRegistryName() + "_bound", "inventory"));

}
项目:CustomWorldGen    文件:BlockStateMapper.java   
public Map<IBlockState, ModelResourceLocation> putAllStateModelLocations()
{
    Map<IBlockState, ModelResourceLocation> map = Maps.<IBlockState, ModelResourceLocation>newIdentityHashMap();

    for (Block block : Block.REGISTRY)
    {
        map.putAll(this.getVariants(block));
    }

    return map;
}
项目:Anima-Mundi    文件:AnimaBlocks.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void registerModels(ModelRegistryEvent event)
{
    blocks.forEach(
            block->ModelLoader.setCustomModelResourceLocation(
                    Item.getItemFromBlock(block),
                    0,
                    new ModelResourceLocation(block.getRegistryName(), "inventory"))
    );

}
项目:Metalworks    文件:ItemToolCollection.java   
@SideOnly(Side.CLIENT)
public void bakeModels(){
    ModelLoader.setCustomModelResourceLocation(pickaxe, 0, new ModelResourceLocation(pickaxe.getRegistryName(), "invenory"));
    ModelLoader.setCustomModelResourceLocation(shovel, 0, new ModelResourceLocation(shovel.getRegistryName(), "invenory"));
    ModelLoader.setCustomModelResourceLocation(sword, 0, new ModelResourceLocation(sword.getRegistryName(), "invenory"));
    ModelLoader.setCustomModelResourceLocation(axe, 0, new ModelResourceLocation(axe.getRegistryName(), "invenory"));
}
项目:ChatBomb    文件:ModBlocks.java   
@SideOnly(Side.CLIENT)
private static void registerBlockModel(Block block, int metadata) {
    // Register the item model.
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), metadata,
            new ModelResourceLocation(block.getRegistryName(), "inventory"));

    System.out.println("Registered block model ~ " + block.getRegistryName() + " ~ " + block.getUnlocalizedName());
}
项目:ExPetrum    文件:ExPStateMappers.java   
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
{
    switch (state.getValue(ExPBlockProperties.SHRUBBERY_TYPE))
    {
        case TROPICAL:
        {
            return new ModelResourceLocation("exp:tropical_shrubbery", String.format("color=%s,leaf=%d", state.getValue(BlockGenericShrubbery.BLOOM_COLOR).getName(), state.getValue(BlockGenericShrubbery.TROPIC_PLANT_LEAF)));
        }

        case FLOWER:
        {
            return new ModelResourceLocation("exp:flower_shrubbery", String.format("color=%s", state.getValue(BlockGenericShrubbery.BLOOM_COLOR).getName()));
        }

        case SMALL_SHRUB:
        {
            return new ModelResourceLocation("exp:small_shrubbery", String.format("color=%s", state.getValue(BlockGenericShrubbery.BLOOM_COLOR).getName()));
        }

        case MUSHROOM:
        {
            return new ModelResourceLocation("exp:mushroom_shrubbery", String.format("color=%s", state.getValue(BlockGenericShrubbery.BLOOM_COLOR).getName()));
        }

        default:
        {
            return new ModelResourceLocation(b.getRegistryName(), "normal");
        }
    }
}
项目:ArcaneMagic    文件:IHasModel.java   
@SideOnly(Side.CLIENT)
default public void initModels(ModelRegistryEvent e)
{
    if (this instanceof Item)
        sMRL("items", (Item) this, 0, "item=" + ((Item) this).getRegistryName().getResourcePath());
    else if (this instanceof Block)
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock((Block) this), 0,
                new ModelResourceLocation(((IForgeRegistryEntry<?>) this).getRegistryName(), "inventory"));
    else
        throw new IllegalStateException("wat are u doin");
}
项目:Adventurers-Toolbox    文件:ItemATAxe.java   
public void initModel() {
    ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName().toString()));
}
项目:Lanolin    文件:ItemLanolin.java   
@SideOnly(Side.CLIENT)
public void initModel() {
    ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}
项目:CustomWorldGen    文件:DefaultStateMapper.java   
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
{
    return new ModelResourceLocation((ResourceLocation)Block.REGISTRY.getNameForObject(state.getBlock()), this.getPropertyString(state.getProperties()));
}
项目:CustomWorldGen    文件:ForgeHooksClient.java   
public static void onModelBake(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader)
{
    MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, modelLoader));
    modelLoader.onPostBakeEvent(modelRegistry);
}
项目:uniquecrops    文件:UCItems.java   
@SideOnly(Side.CLIENT)
public static void initModels() {

    UCBaubles.initModels();

    registerItemModel(seedsNormal);
    registerItemModel(seedsPrecision);
    registerItemModel(seedsKnowledge);
    registerItemModel(seedsDirigible);
    registerItemModel(seedsMillennium);
    registerItemModel(seedsEnderlily);
    registerItemModel(seedsCollis);
    registerItemModel(seedsInvisibilia);
    registerItemModel(seedsMaryjane);
    registerItemModel(seedsWeepingbells);
    registerItemModel(seedsMusica);
    registerItemModel(seedsCinderbella);
    registerItemModel(seedsMerlinia);
    registerItemModel(seedsFeroxia);
    registerItemModel(seedsEula);
    registerItemModel(seedsCobblonia);
    registerItemModel(seedsDyeius);
    registerItemModel(seedsAbstract);
    registerItemModel(seedsWafflonia);
    registerItemModel(seedsDevilsnare);
    registerItemModel(seedsPixelsius);
    registerItemModel(seedsArtisia);
    registerItemModel(seedsPetramia);
    registerItemModel(seedsMalleatoris);

    for (int i = 0; i < EnumItems.values().length; ++i)
        ModelLoader.setCustomModelResourceLocation(generic, i, new ModelResourceLocation(generic.getRegistryName() + "." + EnumItems.values()[i].getName(), "inventory"));

    registerItemModel(largeplum);
    registerItemModel(teriyaki);
    registerItemModel(heart);
    registerItemModel(potionreverse);
    registerItemModel(goldenbread);
    registerItemModel(dietpills);
    registerItemModel(waffle);

    registerItemModel(edibleDiamond);
    registerItemModel(edibleEmerald);
    registerItemModel(edibleLapis);
    registerItemModel(edibleIngotIron);
    registerItemModel(edibleIngotGold);
    registerItemModel(edibleNuggetGold);

    registerItemModel(endersnooker);
    registerItemModel(glasses3D);
    registerItemModel(poncho);
    registerItemModel(slippers);
    registerItemModel(pixelglasses);
    registerItemModel(precisionPick);
    registerItemModel(precisionAxe);
    registerItemModel(precisionShovel);
}
项目:Melodium    文件:BlockBase.java   
@Override
public void initModel(){
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName().toString(),"inventory"));
}
项目:pnc-repressurized    文件:FluidStateMapper.java   
public FluidStateMapper(Fluid fluid) {
    this.fluid = fluid;
    this.location = new ModelResourceLocation(RL("fluid"), fluid.getName());
}
项目:PowerProbe    文件:ItemRedstoneArmor.java   
private static void registerRendersHelmet() {
  Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
      .register(INSTANCE_HELMET, 0, new ModelResourceLocation(PowerProbe.MODID + ":" + NAME + "_helmet", "inventory"));
}
项目:pnc-repressurized    文件:FluidStateMapper.java   
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
    return location;
}
项目:pnc-repressurized    文件:IC2.java   
@SideOnly(Side.CLIENT)
private void registerModel(Block block) {
    Item item = ItemBlock.getItemFromBlock(block);
    ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
项目:Defier    文件:ClientProxy.java   
private static void registerItem(Item item, int meta){
    ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName() + (meta == 0 ? "" : meta + ""), "inventory"));
}
项目:Minecoprocessors    文件:BlockMinecoprocessor.java   
private static void registerRender(String file, int meta) {
  ModelResourceLocation model = new ModelResourceLocation(file, "inventory");
  Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ITEM_INSTANCE, meta, model);
}
项目:Minecoprocessors    文件:ItemBookCode.java   
@SubscribeEvent
public static void registerModels(@SuppressWarnings("unused") ModelRegistryEvent event) {
  ModelLoader.setCustomModelResourceLocation(INSTANCE, 0, new ModelResourceLocation(REGISTRY_NAME, "inventory"));
}
项目:FoodCraft-Reloaded    文件:ItemVegetable.java   
@Nullable
@Override
public ModelResourceLocation getModelLocation() {
    return new ModelResourceLocation(new ResourceLocation(FoodCraftReloaded.MODID, NameBuilder.buildRegistryName("vegetable", vegetableType.toString())), "inventory");
}
项目:FoodCraft-Reloaded    文件:ItemFruitJuice.java   
@Nullable
@Override
public ModelResourceLocation getModelLocation() {
    return new ModelResourceLocation(new ResourceLocation(FoodCraftReloaded.MODID, "juice"), "inventory");
}
项目:ArcaneMagic    文件:IHasModel.java   
public static void sMRL(String statePath, Item k, int meta, String variant)
{
    ModelLoader.setCustomModelResourceLocation(k, meta,
            new ModelResourceLocation(ArcaneMagic.MODID + ":" + statePath, variant));
}