Jump to content

[SOLVED] [1.12.2] Register custom item model


r00t

Recommended Posts

Hello,

I tried to create a custom model block. The block renders fine in the world but does not in the inventory and if dropped on the ground. The item renders the texture in textures/items/. According to this tutorial, the default behavior should have been loading the "inventory" variant of the blockstate json. 

 

What could I have done to override this behavior or am I missing a registration?

 

{
  "forge_marker": 1,
  "defaults": {
    "model": "modid:rock.obj",
    "custom": { "flip-v": true },
    "scale": 0.5,
    "textures": {
      "#None": "modid:blocks/rock"
    }
  },
  "variants": {
    "normal": [
      {}
    ],
    "inventory": [
      {
        "transform": {
          "gui": {
            "scale": 1.8,
            "translation": [0,0.6,0],
            "rotation": [{"x": 15},{"y": 45}]
          },
          "ground": {
            "scale": 0.5,
            "translation": [0,0.0,0]
          },
          "firstperson": {
            "scale": 0.75,
            "translation": [0,0.2,0]
          },
          "thirdperson": {
            "scale": 0.75,
            "translation": [0,0.2,0]
          }
        }
      }
    ],
    "facing": {
      "north": {},
      "south": {
        "y": 180
      },
      "west": {
        "y": 270
      },
      "east": {
        "y": 90
      }
    }
  }
}

 

This is a method of the Block which gets called after all block instances have been created.

    @SideOnly(Side.CLIENT)
    public void initModel() {
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
    }
    
    

 

Thanks.

Edited by r00t
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.