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