Jump to content

[1.12.2] [SOLVED] Block model json ignored (Cannot load more than one layer to a block model)


Recommended Posts

Posted (edited)

Hey. I'm trying to create a universal block for easier ore block creation making it a bit like the item spawn eggs. I made two different textures, one the ore without the core substance (just plain rock) and one the core substance (without the rock)  coloured to white so it can be easily coloured procedurally. The rest of each texture is transparent.

The problem I have encountered is that I cannot make the model use both of the layers of the texture. Also, I see some strange behaviour so that both the blockstate json and the model json ignore completely the texture variables and use only the #all field (currently marked as a comment) in the blockstate file. Funny and also weird thing is, the game remembers what this field was when I cut it out. So it uses a texture even if nowhere in the code is any reference to the texture itself. Creepy.
 

I  can't upload a picture (dunno why, it says "200" as an explanation) but the block is properly coloured but there is only one texture (one layer) of the block visible. The rest of the texture (which should be filled with the second texture) is transparent. [Oh, look, I can now!] The yellow item in the first slot is an Item with the "core" texture (coloured to yellow).

 

Both of the json files get loaded. I don't get any exceptions logged. Both of the textures are visible to the game (I mean I already use them during troubleshooting with this and they got loaded normally).

 

Thanks in advance for any help.


The code of  sulphur_ore.json (the blockstate file):

{
	"forge_marker": 1,
	"defaults": {
		"textures": {
			//"all": "diversitymod:blocks/ore_core",
			"layer0": "diversitymod:blocks/ore_core",
			"layer1": "diversitymod:blocks/ore_rock"
		}
	},
	"variants": {
		"normal": {
			"model": "diversitymod:multi_ore"
		},
		"inventory": {
			"model": "diversitymod:multi_ore"
		}
	}
}


The code of multi_ore.json (the model file):
 

{   
"forge_marker": 1,
"parent": "block/block",
    "textures": {
        "particle": "diversitymod:blocks/ore_rock",
		"layer0": "diversitymod:blocks/ore_core",
		"layer1": "diversitymod:blocks/ore_rock"
		
    },
    "elements": [
        {   "from": [ 0, 0, 0 ],
            "to": [ 16, 16, 16 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "down" },
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "up" },
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "north" },
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "south" },
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "west" },
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#layer0", "tintindex": 0, "cullface": "east" }
            }
        },
		{   "from": [ 0, 0, 0 ],
            "to": [ 16, 16, 16 ],
            "faces": {
                "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "tintindex": 1, "cullface": "down" },
                "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "tintindex": 1, "cullface": "up" },
                "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "tintindex": 1, "cullface": "north" },
                "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "tintindex": 1, "cullface": "south" },
                "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "tintindex": 1, "cullface": "west" },
                "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#layer1", "tintindex": 1, "cullface": "east" }
            }
        }
    ]
}

 

The code of the block:

package com.jantek.diversity.blocks;

import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.BlockRenderLayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockMultiOre extends BlockDiverse{

	public static int COLOR;
	public BlockMultiOre(String name, int color) {
		super(Material.ROCK, name);
		COLOR=color;
		setHardness(3f);
		setResistance(5f);
	}

	@Override
	public BlockMultiOre setCreativeTab(CreativeTabs tab) {
		super.setCreativeTab(tab);
		return this;
	}
	
	@Override
    public boolean isOpaqueCube(IBlockState state) { return false; }
	
	 @Override
     public boolean isFullCube(IBlockState state) { return false; }

	 @SideOnly(Side.CLIENT)
	 public BlockRenderLayer getBlockLayer(){
	        return BlockRenderLayer.CUTOUT;
	    }
}

 

screen jedna warstwa.jpg

Edited by Jantek
problem solved
Posted

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
12 hours ago, Draco18s said:

Thanks! But after more tries I discovered that the game just ignores the model json. I don't know why. A shame it took me so long to discover that.

So, why the game ignores it? As far as I know I don't have to register a custom model for a block, the model is just referenced in the blockstate json. Assuming I am wrong, I tried to call ModelLoader#registerCustomResourceLocation along with ModelBakery#registerItemVariants but still no change. Nor an exception thrown. What am I doing wrong?

Posted

I make a custom model for all my custom blocks, even if they are just cubes. The game certainly does not ignore them, as you can tell by the fact the texture gets properly referenced.

 

What do you mean that it ignores your model? Like if you edit things in the model that nothing changes at all? Or you mean just that the layering system isn't working?

 

Is it possible it is one of those graphics rendering ambiguities where both your layers are right on top of each other so only one gets rendered. What happens if you change the element x, y, z for the first layer to be smaller than full cube start = (0.1, 0.1, 0.1) and finish = (15.9, 15.9, 15.9)?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
2 hours ago, jabelar said:

I make a custom model for all my custom blocks, even if they are just cubes. The game certainly does not ignore them, as you can tell by the fact the texture gets properly referenced.

 

What do you mean that it ignores your model? Like if you edit things in the model that nothing changes at all? Or you mean just that the layering system isn't working?

 

Is it possible it is one of those graphics rendering ambiguities where both your layers are right on top of each other so only one gets rendered. What happens if you change the element x, y, z for the first layer to be smaller than full cube start = (0.1, 0.1, 0.1) and finish = (15.9, 15.9, 15.9)?

I made a test by changing the size of the boxes of both layers to 10 pixels. Nothing changed. That made me think the game still uses some default model like block/block. This also makes sense explaining why changing the textures.#all variable in blockstate file actually changed the texture while changing other (custom) texture variables and also the #all variable in the model file changed nothing. 

So I also checked for some spelling mistakes in the reference to the model file. Like misspelling the modid or adding additional '/models/' to the path but I found none.

Posted
21 hours ago, Jantek said:

I made a test by changing the size of the boxes of both layers to 10 pixels. Nothing changed. 

My suggestion was actually to make each layer different sizes. If they are exact same size as each other then I can imagine that in graphics rendering terms maybe one gets culled somehow.

 

Actually, now that I'm thinking about it, is this some sort of face culling problem? Like is the inside layer being treated as something behind the outer layer that then doesn't need rendering? Maybe your cullface parameters in your model are causing this issue. 

 

Anyway, I'm not an expert in this area so just giving ideas. 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
21 hours ago, Jantek said:

I made a test by changing the size of the boxes of both layers to 10 pixels. Nothing changed.

 

I actually had the same problem more than once while using eclipse and notepad++ as editor. The problem was, that eclipse apparently holds a cached version of textfiles in its memory or something, putting the cached version to the exceuted mod. The solution I found to always have the freshest, is to select the resources folder in eclipse and press F5 (refresh) once. After that I can start the game and the model is changed properly. The same thing is with textures. Edited outside, they doesn't seem to be taken over except when refreshing the resource folder.

 

Maybe worth a try.

  • Like 1
Posted

Fixed. As SatyPardus said, the problem happened to be so simple and stupid in fact. I was using Eclipse for coding and Notepad++ for  json files. But Eclipse doesn't always sync well with changes in the OS file system without manually refreshing. The strange behaviour was caused by the cache of Eclipse. I once thought I fixed the problem using ModelLoader.setCustomModelResourceLocation() but the point is, it forced me to copy the model also to the item folder and I did copying within Eclipse so it forced the Eclipse to reload the file and BAM! it works.

A really big pain in the ass if one is aware of this behaviour. 

Man, I was hard trying like everything for few days just because I didn't press F5...

screen dziala git.jpg

Posted
20 minutes ago, Jantek said:

But Eclipse doesn't always sync well with changes in the OS file system without manually refreshing. The strange behaviour was caused by the cache of Eclipse.

First: http://shouldiblamecaching.com/

Second: Go to the Eclipse marketplace and download the JSON Editor plugin. Edit your JSON files inside Eclipse, then Eclipse will know that they've changed.

  • Like 2

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
43 minutes ago, Jantek said:

 But Eclipse doesn't always sync well with changes in the OS file system without manually refreshing. The strange behaviour was caused by the cache of Eclipse.

Or you could also refresh your projects in eclipse.

Just press "ALT+P+N" and "ENTER" :P

Always looking for new challenges, and happy to help the people where ever I can

  • 11 months later...
Posted

Or you could use IntelliJ

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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