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


Java ItemMeshDefinition类代码示例

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


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

示例1: initModel

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
   public void initModel() {
	final Map<WolfArmor, ModelResourceLocation> models = Maps.newHashMap();
	for(WolfArmor armor : new WolfArmor[]{WolfArmor.LEATHER, WolfArmor.CHAIN, WolfArmor.IRON, WolfArmor.DIRON, WolfArmor.DIAMOND, WolfArmor.GOLD}){
		ModelResourceLocation loc = new ModelResourceLocation("crystalmod:wolfarmor", "armor="+armor.name().toLowerCase());
		models.put(armor, loc);
		ModelBakery.registerItemVariants(this, loc);
	}
       ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {
           @Override
           public ModelResourceLocation getModelLocation(ItemStack stack) {
           	return models.get(getWolfArmor(stack));
           }
       });
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:17,代码来源:ItemWolfArmor.java

示例2: registerBlockWithStateMapper

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
public static void registerBlockWithStateMapper(Block block)
{
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getBlockModelShapes().registerBlockWithStateMapper(block, new StateMapperBase() 
	{
		@Override
		protected ModelResourceLocation getModelResourceLocation(IBlockState state)
		{
			return new ModelResourceLocation(state.getBlock().getRegistryName(), "normal");
		}
		
	});

	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), new ItemMeshDefinition() 
	{
		@Override
		public ModelResourceLocation getModelLocation(ItemStack stack) 
		{
			return new ModelResourceLocation(stack.getItem().getRegistryName(), "inventory");
		}
	});
}
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:22,代码来源:BlockRendering.java

示例3: registerRenderer

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void registerRenderer() {
    IFluidBlock block = BlocksRegistry.liquidXpBlock;
    Item item = Item.getItemFromBlock((Block)block);
    assert (item == Items.AIR);

    ModelBakery.registerItemVariants(item);

    ModelResourceLocation modelResourceLocation = new ModelResourceLocation(MekfarmMod.MODID + ":fluids", this.getName());

    ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return modelResourceLocation;
        }
    });

    ModelLoader.setCustomStateMapper((Block) block, new StateMapperBase() {
        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return modelResourceLocation;
        }
    });
}
 
开发者ID:faceofcat,项目名称:Mekfarm,代码行数:25,代码来源:LiquidXPFluid.java

示例4: registerRenderer

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void registerRenderer() {
    IFluidBlock block = BlocksRegistry.sewageBlock;
    Item item = Item.getItemFromBlock((Block)block);
    assert (item == Items.AIR);

    ModelBakery.registerItemVariants(item);

    ModelResourceLocation modelResourceLocation = new ModelResourceLocation(MekfarmMod.MODID + ":fluids", this.getName());

    ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return modelResourceLocation;
        }
    });

    ModelLoader.setCustomStateMapper((Block) block, new StateMapperBase() {
        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return modelResourceLocation;
        }
    });
}
 
开发者ID:faceofcat,项目名称:Mekfarm,代码行数:25,代码来源:SewageFluid.java

示例5: registerFluidModel

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
public void registerFluidModel(Block  block) {
	Item item = Item.getItemFromBlock(block);

	ModelBakery.registerItemVariants(item);

	final ModelResourceLocation loc = new ModelResourceLocation(Reference.MODID + ":fluid", "liquidmalgra");

	ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
		@Override
		public ModelResourceLocation getModelLocation(ItemStack stack) {
			return loc;
		}
	});

	ModelLoader.setCustomStateMapper(block, new StateMapperBase() {
		@Override
		protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
			return loc;
		}
	});
}
 
开发者ID:Ohrm,项目名称:Malgra,代码行数:22,代码来源:ClientProxy.java

示例6: registerISensitiveMeshes

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@Override
public void registerISensitiveMeshes(Collection<Item> items) {
    for (Item it : items) {
        if (!(it instanceof ISensitiveMesh)) {
            continue;
        }
        final ISensitiveMesh ism = (ISensitiveMesh) it;
        ModelLoader.setCustomMeshDefinition(it, new ItemMeshDefinition() {
            @Override
            public ModelResourceLocation getModelLocation(ItemStack stack) {
                String meshName = ism.getMeshName(stack);
                return new ModelResourceLocation("factorization:" + meshName + "#inventory");
            }
        });
        for (ItemStack is : ism.getMeshSamples()) {
            ModelLoader.addVariantName(it, "factorization:" + ism.getMeshName(is));
        }
    }
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:20,代码来源:FactorizationClientProxy.java

示例7: registerRender

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void registerRender() {
	ModelResourceLocation[] locations = new ModelResourceLocation[]{
				new ModelResourceLocation(this.getRegistryName() + "_empty", "inventory"),
				new ModelResourceLocation(this.getRegistryName() + "_chest", "inventory"),
				new ModelResourceLocation(this.getRegistryName() + "_storage_core", "inventory")
			};
	ModelBakery.registerItemVariants(this, locations);
	ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {
		@Override
		public ModelResourceLocation getModelLocation(ItemStack stack) {
			if(stack.hasTagCompound() && stack.getTagCompound().getBoolean("isFull")) {
				if(stack.getTagCompound().getBoolean("isChest")) {
					return locations[1];
				}
				if(stack.getTagCompound().getBoolean("isStorageCore")) {
					return locations[2];
				}
			}
			return locations[0];
		}
	});
}
 
开发者ID:zerofall,项目名称:EZStorage2,代码行数:25,代码来源:ItemDolly.java

示例8: postRegisterBlock

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@Override
public void postRegisterBlock(FWBlock block) {
	super.postRegisterBlock(block);

	//Hack to inject custom itemblock definition
	Item itemFromBlock = Item.getItemFromBlock(block);

	ModelLoader.setCustomMeshDefinition(itemFromBlock, new ItemMeshDefinition() {
			@Override
			public ModelResourceLocation getModelLocation(ItemStack stack) {
				ResourceLocation itemRL = (ResourceLocation) Item.itemRegistry.getNameForObject(itemFromBlock);
				return new ModelResourceLocation(itemRL, "inventory");
			}
		}
	);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:17,代码来源:ClientProxy.java

示例9: __getCustomMeshDefinition

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@Override
public Optional<ItemMeshDefinition> __getCustomMeshDefinition() {
  // DO NOT use a lambda here, converting this code to a lambda results
  // in the model being unresolvable

  //noinspection Convert2Lambda
  return Optional.of(new ItemMeshDefinition() {
    @Override
    public ModelResourceLocation getModelLocation(ItemStack stack) {
      Optional<org.spongepowered.api.item.inventory.ItemStack> optContained = getPrizeStack(stack);

      return optContained.isPresent() ? new ModelResourceLocation(
          optContained.get().getItem().getId(),
          "inventory"
      ) : null;
    }
  });
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:19,代码来源:PrizeBox.java

示例10: buildRenderFor

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void buildRenderFor(Block block, String name)
{
	final ModelResourceLocation fluidLocation = new ModelResourceLocation(MReference.MODID + ":" + name, "fluid");
	Item fluid = Item.getItemFromBlock(block);
	ModelBakery.addVariantName(fluid);
	ModelLoader.setCustomMeshDefinition(fluid, new ItemMeshDefinition()
	{
		@Override
		public ModelResourceLocation getModelLocation(ItemStack stack)
		{
			return fluidLocation;
		}
	});
	ModelLoader.setCustomStateMapper(block, new StateMapperBase()
	{
		@Override
		protected ModelResourceLocation getModelResourceLocation(IBlockState state)
		{
			return fluidLocation;
		}
	});
}
 
开发者ID:MinestrapTeam,项目名称:Minestrappolation-4,代码行数:24,代码来源:MFluid.java

示例11: preInit

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
public static void preInit()
{
    for (final ItemLootBag item : ItemLootBag.getLootBags())
    {
        // IDK which one is effective, or which one is recommended. So I'm using them all.
        // The modeling system is confusing...
        ModelLoader.registerItemVariants(item, new ModelResourceLocation(item.texture), new ModelResourceLocation(item.texture, "inventory"));
        ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
            @Override
            public ModelResourceLocation getModelLocation(ItemStack stack)
            {
                return new ModelResourceLocation(item.texture);
            }
        });
        ModelLoader.registerItemVariants(item, new ModelResourceLocation(item.texture));
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.texture));
    }
}
 
开发者ID:DoubleDoorDevelopment,项目名称:JsonLootBags,代码行数:19,代码来源:ClientHelper.java

示例12: bakeModels

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void bakeModels(String modID){
	for(Fluid fluid : fluidBlocks.keySet()){
		BlockFluidBase block = fluidBlocks.get(fluid);
		Item item = Item.getItemFromBlock(block);
		final ModelResourceLocation fluidModelLocation = new ModelResourceLocation(
				modID.toLowerCase() + ":" + fluidBlockNames.get(block), "fluid");
           ModelBakery.registerItemVariants(item);
		ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition()
		{
			public ModelResourceLocation getModelLocation(ItemStack stack)
			{
				return fluidModelLocation;
			}
		});
		ModelLoader.setCustomStateMapper(block, new StateMapperBase()
		{
			protected ModelResourceLocation getModelResourceLocation(IBlockState state)
			{
				return fluidModelLocation;
			}
		});
	}
}
 
开发者ID:cyanobacterium,项目名称:BaseMetals,代码行数:25,代码来源:Fluids.java

示例13: registerModelLocation

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
private void registerModelLocation(final Item item, final String name, final String type) {
	RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
	//System.out.println("registerModelLocation for " + name);
	if (renderItem != null) {
        renderItem.getItemModelMesher().register(item, new ItemMeshDefinition() {
            @Override
            public ModelResourceLocation getModelLocation(ItemStack stack) {
            	//System.out.println(name + "/" + stack.getUnlocalizedName());
            	
            	if (item instanceof ISubtypeFromStackPovider && ((ISubtypeFromStackPovider)item).getSubType(stack) != null) {
            		//System.out.println(ModInfo.ModID + ":" + name + "/" + ((ISubtypeFromStackPovider)item).getSubType(stack));
            		return new ModelResourceLocation(ModInfo.ModID + ":" + name + "/" + ((ISubtypeFromStackPovider)item).getSubType(stack), type);
            	} else {
            		return new ModelResourceLocation(ModInfo.ModID + ":" + name, type);
            	}
            }
        });
	}	
}
 
开发者ID:tyronx,项目名称:vintagecraft,代码行数:20,代码来源:ClientProxy.java

示例14: reflectMaps

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:25,代码来源:ModelNullifierBaked.java

示例15: registerResources

import net.minecraft.client.renderer.ItemMeshDefinition; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void registerResources() {
	String[] variants = getVariants();
	models = new ArrayList<ModelResourceLocation>(variants.length);
	for (int i = 0; i < variants.length; ++i) {
		models.add(new ModelResourceLocation(variants[i], "inventory"));
	}
	ModelLoader.registerItemVariants(this, models.toArray(new ModelResourceLocation[0]));
	ModelLoader.setCustomMeshDefinition(this, new ItemMeshDefinition() {
		@Override
		public ModelResourceLocation getModelLocation(ItemStack stack) {
			return models.get(0);
		}
	});
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:17,代码来源:ItemHeroBow.java


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