Jump to content

[1.8] Rendering Item


expert700

Recommended Posts

I can't figure out for the life of me why this isn't working as it was working fine a few months ago, but whenever I try to render a simple item I get the error "Model definition for location x#inventory not found"

Here's the class registering it

package com.bryceclark56.horticulture.Item;

import com.bryceclark56.horticulture.Reference.Reference;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class Items
{
    public static final FoodHorticulture lettuce = new FoodHorticulture(6, 2, false).setUnlocalizedName("lettuce");

    public static void registerRenderer(Item item, String name)
    {
        ModelBakery.addVariantName(item, Reference.MOD_ID + ":" + name);
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + name, "inventory"));
    }

    public static void init()
    {
        GameRegistry.registerItem(lettuce, "lettuce");
    }

    public static void registerModels()
    {
        registerRenderer(lettuce, "lettuce");
    }
}

And the JSON file.

{
  "parent": "builtin/generated",
  "textures": {
    "layer0": "horticulture:items/lettuce"
  },
  "display": {
    "thirdperson": {
      "rotation": [ -90, 0, 0 ],
      "translation": [ 0, 1, -3 ],
      "scale": [ 0.55, 0.55, 0.55 ]
    },
    "firstperson": {
      "rotation": [ 0, -135, 25 ],
      "translation": [ 0, 4, 2 ],
      "scale": [ 1.7, 1.7, 1.7 ]
    }
  }
}

Also worth noting that the renderer is only being registered on the client proxy so that's not the problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.