Jump to content

[1.10.2] [SOLVED] Block missing texture in inventory


Bektor

Recommended Posts

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.

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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" }
    }
}

Link to comment
Share on other sites

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.

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.