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


Java ModelLoader类代码示例

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


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

示例1: registerItemRenderer

import net.minecraftforge.client.model.ModelLoader; //导入依赖的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

示例2: registerRenders

import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void registerRenders() {
    enumInstanceMap.values().stream().map(Map::entrySet).map(Collection::stream).forEach(entries -> entries.forEach(entry -> {
        if (Item.class.isAssignableFrom(entry.getValue().getClass())) {
            if (entry.getValue() instanceof CustomModelMasking) {
                registerRender((Item) entry.getValue(), 0, ((CustomModelMasking) entry.getValue()).getModelLocation());
                FoodCraftReloaded.getLogger().debug("Registered custom model " + entry.getValue().getClass() + " as " + ((CustomModelMasking) entry.getValue()).getModelLocation());
            } else if (((Item) entry.getValue()).getRegistryName() != null) {
                registerRender((Item) entry.getValue(), 0, new ModelResourceLocation(((Item) entry.getValue()).getRegistryName(), "inventory"));
            }
        } else if (BlockFluidBase.class.isAssignableFrom(entry.getValue().getClass())) {
            // TODO Null condition
            registerFluidRender((BlockFluidBase) entry.getValue(), ((Block)entry.getValue()).getRegistryName().getResourcePath());
        } else if (Block.class.isAssignableFrom(entry.getValue().getClass())) {
            if (entry.getValue() instanceof CustomModelMasking)
                ModelLoader.setCustomStateMapper((Block) entry.getValue(), block -> ((CustomModelMasking) entry.getValue()).getStateModelLocations());
        }
    }));
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:20,代码来源:EnumLoader.java

示例3: initModel

import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@Override
public void initModel() {
	ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(),"inventory"));
	ModelLoader.setCustomModelResourceLocation(this, 1, new ModelResourceLocation(getRegistryName(),"inventory"));
	ModelLoader.setCustomModelResourceLocation(this, 2, new ModelResourceLocation(getRegistryName(),"inventory"));
	ModelLoader.setCustomModelResourceLocation(this, 3, new ModelResourceLocation(getRegistryName(),"inventory"));
	ModelLoader.setCustomModelResourceLocation(this, 4, new ModelResourceLocation(getRegistryName(),"inventory"));
}
 
开发者ID:elucent,项目名称:SimplyTea,代码行数:9,代码来源:SimplyTea.java

示例4: registerInventoryModels

import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void registerInventoryModels(final ModelRegistryEvent event)
{
	for (Item item : items)
	{
		if (item instanceof IMultiItem)
		{
			final Class enumClass = (Class<?>)ReflectionUtils.getGenericInterfaceType(item.getClass(), IMultiItem.class);
			for (ISubItem value : (ISubItem[])enumClass.getEnumConstants())
			{
				ModelLoader.setCustomModelResourceLocation(item, value.getMetadata(), new ModelResourceLocation(item.getRegistryName(), "inventory"));
			}
		}
		else
		{
			ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
		}
	}

}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:22,代码来源:ModItems.java

示例5: registerItemModel

import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
public void registerItemModel(Item item) {
	ResourceLocation loc = Item.REGISTRY.getNameForObject(item);
	if (item instanceof ItemBlockEquivalentState) {
		
		NonNullList<ItemStack> subItems = NonNullList.create();
		item.getSubItems(ThermionicsWorld.TAB_THERMIONICS_WORLD, subItems);
		for(ItemStack stack : subItems) {
			Item stackItem = stack.getItem();
			if (stackItem!=item) continue; //The contract of getSubItems prohibits this condition.
			String keys = ((ItemBlockEquivalentState)item).getStateStringForItem(stack);
			//System.out.println("Registering model for "+loc+"#"+keys+" == meta:"+stack.getItemDamage());
			
			ModelLoader.setCustomModelResourceLocation(stackItem, stack.getItemDamage(),
					new ModelResourceLocation(loc, keys)
					);
		}
	} else if (item instanceof ItemBlockGemrock) {
		for(int i=0; i<16; i++) {
			ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(loc,"variant="+i));
		}
	} else if (item instanceof ItemBlockVarieties) {
		for(int i=0; i<16; i++) {
			ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(loc,"variant="+i));
		}
	} else {
		ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(loc, "inventory"));
	}
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:29,代码来源:ClientProxy.java

示例6: registerRender

import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
private static void registerRender(Item item, int meta, String name) {
	ModelResourceLocation model = new ModelResourceLocation(name, "inventory");
	ModelLoader.setCustomModelResourceLocation(item, meta, model);
}
 
开发者ID:PorPit,项目名称:MineCamera,代码行数:6,代码来源:ItemLoader.java

示例7: registerShrubberyModels

import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
public static void registerShrubberyModels()
{
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 0, new ModelResourceLocation(new ResourceLocation("exp", "tropical_shrubbery"), "color=none,leaf=0"));
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 1, new ModelResourceLocation(new ResourceLocation("exp", "flower_shrubbery"), "color=white"));
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 2, new ModelResourceLocation(new ResourceLocation("exp", "small_shrubbery"), "color=white"));
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ExPBlocks.genericShrubbery), 3, new ModelResourceLocation(new ResourceLocation("exp", "mushroom_shrubbery"), "color=red"));
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:8,代码来源:ClientRegistry.java

示例8: registerRender

import net.minecraftforge.client.model.ModelLoader; //导入依赖的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.minecraftforge.client.model.ModelLoader; //导入依赖的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: initModel

import net.minecraftforge.client.model.ModelLoader; //导入依赖的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

示例11: registerModels

import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@SubscribeEvent
public static void registerModels(ModelRegistryEvent event){
	StateMapperBase mapper=new StateMapperBase() {
		
		@Override
		protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
			return new ModelResourceLocation(new ResourceLocation(Constants.MODID, "creosote"), "creosote");
		}
	};
	if(FluidsRegistry.BlockCreosote!=null)
		ModelLoader.setCustomStateMapper(FluidsRegistry.BlockCreosote, mapper);
}
 
开发者ID:EnderiumSmith,项目名称:CharcoalPit,代码行数:13,代码来源:BlocksRegistry.java

示例12: registerItem

import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
public static <BBItem extends Item & IBBName> void registerItem(BBItem item)
{
    if(item instanceof ISpecialRender)
	((ISpecialRender) item).registerRender();
    else
	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:8,代码来源:RegisterModels.java

示例13: registerModel

import net.minecraftforge.client.model.ModelLoader; //导入依赖的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

示例14: setupModels

import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void setupModels()
{
    for(MagibenchRegistry.Tier t : PurMag.INSTANCE.getMagibenchRegistry().getTiers())
    {
        ModelLoader.setCustomModelResourceLocation(this, t.getTier(), new ModelResourceLocation(t.getSmartModel(), "normal"));
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:10,代码来源:ItemBlockMagibench.java

示例15: registerFluidBlockRendering

import net.minecraftforge.client.model.ModelLoader; //导入依赖的package包/类
@Override
public void registerFluidBlockRendering(Block block, String name) 
{    	
    final ModelResourceLocation fluidLocation = new ModelResourceLocation(HarshenCastle.MODID.toLowerCase() + ":fluids", name);

    ModelLoader.setCustomStateMapper(block, new StateMapperBase()
    {
        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state)
        {

            return fluidLocation;
        }
    });
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:16,代码来源:ClientProxy.java


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