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

Hi,

 

I'm having a huge problem with my block: It renders perfectly fine in the world, but it does not render in inventory. It just shows a 2D plane with the missing texture texture and when holding in hand it is a cube with missing texture.

 

My block extends the BlockTorch and just adds some custom stuff to it.

Then  I have this code:

 

BlockList.torchOn = new BlockTorch();
BlockList.torchOn.setUnlocalizedName(Constants.MOD_ID.toLowerCase() + "." + "torch_on");
BlockList.torchOn.setRegistryName("torch_on");
GameRegistry.register("torch_on");
ItemBlock itemBlock = new ItemBlock(BlockList.torchOn);
GameRegistry.register(itemBlock.setRegistryName(BlockList.torchOn.getRegistryName()));

 

On the client this will also be called:

/** block */
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BlockList.torchOn), 0, new ModelResourceLocation(BlockList.torchOn.getRegistryName(), "inventory"));

/** item block*/
ModelLoader.setCustomModelResourceLocation(itemBlock, 0, new ModelResourceLocation(itemBlock.getRegistryName(), "inventory"));

 

I hope I posted above everything correct, cause I simplified the code, so no one has to worry about the automatic system which does exactly that from above in the background. (quite a lot of code in the background for achieving this, because I wanted it to work fine with all my blocks and subfolder stuff for the stone blocks)

 

Here are the json files now:

assets.primevalforest.blockstates.torch_on.json

 

{
    "forge_marker": 1,
    "defaults": {
    	"textures": {
    		"all": "primevalforest:blocks/torch_on"
    	},
    	"model": "cube_all"
    },
    "variants": {
    	"facing": {
		"up": { "model": "primevalforest:normal_torch" },
        	"east": { "model": "primevalforest:normal_torch_wall" },
        	"south": { "model": "primevalforest:normal_torch_wall", "y": 90 },
        	"west": { "model": "primevalforest:normal_torch_wall", "y": 180 },
        	"north": { "model": "primevalforest:normal_torch_wall", "y": 270 }
    	}
    }
}

 

 

assets.primevalforest.models.block.normal_torch.json

 

{
"parent": "primevalforest:block/torch_on",
"textures": {
	"torch": "primevalforest:blocks/torch_on"
}
}

 

 

assets.primevalforest.models.block.normal_torch_wall.json

 

{
"parent": "primevalforest:block/torch_wall",
"textures": {
	"torch": "primevalforest:blocks/torch_on"
}
}

 

 

assets.primevalforest.models.block.torch_on.json

 

{
    "ambientocclusion": false,
    "textures": {
        "particle": "#torch"
    },
    "elements": [
        {   "from": [ 7, 0, 7 ],
            "to": [ 9, 10, 9 ],
            "shade": false,
            "faces": {
                "down": { "uv": [ 7, 13, 9, 15 ], "texture": "#torch" },
                "up":   { "uv": [ 7,  6, 9,  8 ], "texture": "#torch" }
            }
        },
        {   "from": [ 7, 0, 0 ],
            "to": [ 9, 16, 16 ],
            "shade": false,
            "faces": {
                "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" },
                "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }
            }
        },
        {   "from": [ 0, 0, 7 ],
            "to": [ 16, 16, 9 ],
            "shade": false,
            "faces": {
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" },
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#torch" }
            }
        }
    ]
}

 

 

assets.primevalforest.models.item.torch_on.json

 

{
"parent": "item/generated",
"textures": {
	"layer0": "primevalforest:blocks/torch_on"
}
}

 

 

There are NO errors in the fml-client-log... the torch_on name isn't even mentioned (checked multiply times, even with the search function of notepad++). Also checked multiply times the console... no errors.

 

So, what am I doing wrong here?

 

Thx in advance.

Bektor

Developer of Primeval Forest.

I had this weird issue where when I fixed the

Item

model for a

Block

, the

Item

ALREADY in my inventory stayed the black-purple box, but the SAME

Item

had a model in the creative tab. Maybe this is happening to you too.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

  • Author

I had this weird issue where when I fixed the

Item

model for a

Block

, the

Item

ALREADY in my inventory stayed the black-purple box, but the SAME

Item

had a model in the creative tab. Maybe this is happening to you too.

Nope, seems not to be.

Developer of Primeval Forest.

If you are specifying a variant default as inventory, you have to define it in the blockstates json file otherwise it has no model definition to reference and therefore will not render in slot as it's missing that variant.

 

Check your console log for the MissingModelVariantException that shows up.

 

The fix is simpler still:

{
     "forge_marker": 1,
     "defaults": {
          "textures": {
               "all" "primevalforest:blocks/torch_on"
    	},
    	"model": "cube_all"
    },
    "variants": {
    	"facing": {
		"up": { "model": "primevalforest:normal_torch" },
        	"east": { "model": "primevalforest:normal_torch_wall" },
        	"south": { "model": "primevalforest:normal_torch_wall", "y": 90 },
        	"west": { "model": "primevalforest:normal_torch_wall", "y": 180 },
        	"north": { "model": "primevalforest:normal_torch_wall", "y": 270 }
    	},
        "inventory": { "model": "priemevalforest:normal_torch" }
    }
}

  • Author

If you are specifying a variant default as inventory, you have to define it in the blockstates json file otherwise it has no model definition to reference and therefore will not render in slot as it's missing that variant.

 

Check your console log for the MissingModelVariantException that shows up.

 

The fix is simpler still:

{
     "forge_marker": 1,
     "defaults": {
          "textures": {
               "all" "primevalforest:blocks/torch_on"
    	},
    	"model": "cube_all"
    },
    "variants": {
    	"facing": {
		"up": { "model": "primevalforest:normal_torch" },
        	"east": { "model": "primevalforest:normal_torch_wall" },
        	"south": { "model": "primevalforest:normal_torch_wall", "y": 90 },
        	"west": { "model": "primevalforest:normal_torch_wall", "y": 180 },
        	"north": { "model": "primevalforest:normal_torch_wall", "y": 270 }
    	},
        "inventory": { "model": "priemevalforest:normal_torch" }
    }
}

This does not work. :(

 

And to this

MissingModelVariantException

: Read the last 4 sentences of my problem. ;)

 

EDIT: Your edit does also not work.

Developer of Primeval Forest.

If you specify in your modelLoader to look for a variant of name "inventory" it REQUIRES that variant to render in the inventory.

 

You miss it out and it's not our problem when it fails to render.

Also you are registering a renderer twice. Once for the block and itemBlock and then again for the itemBlock.

 

Why?

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.