Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

  • Author

I did have it registered in preinit then the model thing in init, I ended up fixing it though I don't exactly know how... I just started over and it ended up working.

I think you have to do the model bakery in the preInit part of the Client Proxy (if existing) and then ModelMesher part in the init method of the Client Proxy.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.