当前位置: 首页>>代码示例>>Java>>正文


Java ModelResourceLocation类代码示例

本文整理汇总了Java中net.minecraft.client.renderer.block.model.ModelResourceLocation的典型用法代码示例。如果您正苦于以下问题:Java ModelResourceLocation类的具体用法?Java ModelResourceLocation怎么用?Java ModelResourceLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ModelResourceLocation类属于net.minecraft.client.renderer.block.model包,在下文中一共展示了ModelResourceLocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerRenderer

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
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"));
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:20,代码来源:ItemBase.java

示例2: registerItemRenderer

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@Override
public void registerItemRenderer(Item i, int meta, String id) {
	ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(ModInfo.MODID + ":" + id, "inventory"));
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:5,代码来源:ClientProxy.java

示例3: process

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:MultiLayerModel.java

示例4: handleModels

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:oitsjustjose,项目名称:Geolosys,代码行数:10,代码来源:ClientRegistry.java

示例5: register

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
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));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:ItemModelMesherForge.java

示例6: initModel

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
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");
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:16,代码来源:IHasModel.java

示例7: mkCustomModelResourceLocations

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
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)));
    }
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:8,代码来源:ClientRegistry.java

示例8: registerRender

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
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);
}
 
开发者ID:trigg,项目名称:Firma,代码行数:16,代码来源:BaseBlock.java

示例9: registerBlock

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
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"));
	}
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:12,代码来源:RegisterModels.java

示例10: setBucketModel

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:ModelLoader.java

示例11: registerItemRenderer

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
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"));
}
 
开发者ID:TheTrueForce,项目名称:Polearms,代码行数:15,代码来源:ItemRenderRegister.java

示例12: registerModel

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
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);
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:8,代码来源:ModelHandler.java

示例13: initModel

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@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");
		}
	});
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:15,代码来源:ItemCompositionPaper.java

示例14: registerModel

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:9,代码来源:ItemRitualChalk.java

示例15: registerFluidRender

import net.minecraft.client.renderer.block.model.ModelResourceLocation; //导入依赖的package包/类
@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");
        }
    });
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:14,代码来源:EnumLoader.java


注:本文中的net.minecraft.client.renderer.block.model.ModelResourceLocation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。