net.minecraft.client.resources.model.ModelResourceLocation Java Examples

The following examples show how to use net.minecraft.client.resources.model.ModelResourceLocation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientProxy.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void registerItem(FWItem item) {
	super.registerItem(item);

	//Hacks to inject custom item definition
	ModelLoader.setCustomMeshDefinition(item, stack -> {
		ResourceLocation itemRL = (ResourceLocation) Item.itemRegistry.getNameForObject(item);
		return new ModelResourceLocation(itemRL, "inventory");
	});
}
 
Example #2
Source File: ClientProxy.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void postRegisterBlock(FWBlock block) {
	super.postRegisterBlock(block);

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

	ModelLoader.setCustomMeshDefinition(itemFromBlock, stack -> {
		ResourceLocation itemRL = (ResourceLocation) Item.itemRegistry.getNameForObject(itemFromBlock);
		return new ModelResourceLocation(itemRL, "inventory");
	});
}
 
Example #3
Source File: ModelRegistryHelper.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static void registerItemRenderer(Item item, IItemRenderer renderer, ResourceLocation location) {
    final ModelResourceLocation modelLoc = new ModelResourceLocation(location, "inventory");
    register(modelLoc, renderer);
    registerItemMesher(item, new ItemMeshDefinition() {
        @Override
        public ModelResourceLocation getModelLocation(ItemStack stack) {
            return modelLoc;
        }
    });
}
 
Example #4
Source File: Mobycraft.java    From mobycraft with Apache License 2.0 4 votes vote down vote up
private void registerItem(Item item, String name) {
	GameRegistry.registerItem(item, name);
	mesher.register(item, 0, new ModelResourceLocation("moby:" + name,
			"inventory"));
}
 
Example #5
Source File: Mobycraft.java    From mobycraft with Apache License 2.0 4 votes vote down vote up
private void registerBlock(Block block, String name) {
	GameRegistry.registerBlock(block, name);
	mesher.register(Item.getItemFromBlock(block), 0,
			new ModelResourceLocation("moby:" + name, "inventory"));
}
 
Example #6
Source File: TeleportBlocks.java    From ModdingTutorials with GNU General Public License v2.0 4 votes vote down vote up
public static void registerRender(Block block)
{
	Item item = Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
 
Example #7
Source File: TeleportItems.java    From ModdingTutorials with GNU General Public License v2.0 4 votes vote down vote up
public static void registerRender(Item item)
{
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
 
Example #8
Source File: TeleportBlocks.java    From ModdingTutorials with GNU General Public License v2.0 4 votes vote down vote up
public static void registerRender(Block block)
{
	Item item = Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
 
Example #9
Source File: TeleportItems.java    From ModdingTutorials with GNU General Public License v2.0 4 votes vote down vote up
public static void registerRender(Item item)
{
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
 
Example #10
Source File: ModelRegistryHelper.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void register(ModelResourceLocation location, IBakedModel model) {
    registerModels.add(new ImmutablePair<ModelResourceLocation, IBakedModel>(location, model));
}
 
Example #11
Source File: ModelRegistryHelper.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void registerItemModel(Item item, int meta, ResourceLocation location) {
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(location, "inventory"));
}
 
Example #12
Source File: ModelRegistryHelper.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SubscribeEvent
public void onModelBake(ModelBakeEvent event) {
    for(Pair<ModelResourceLocation, IBakedModel> pair : registerModels)
        event.modelRegistry.putObject(pair.getKey(), pair.getValue());
}