I'm making a block that has some transparent parts on the front. I tried using the BlockRenderLayer method for a transparent block, and it looked glitchy and awful. I did some digging and found that I can use a multi layer blockstates file to render the two separate pieces of my block. I have two block models, one with the regular solid layer, the other with the translucent layer that goes on the front. When I load my game, I get the dreaded purple and black block that says I've goofed up somewhere. I went as far as to test each separate model in game by replacing an existing block model with each of the models in question. They both work, so I am stumped. My Console does show errors that there was an exception loading the models into the file but it doesn't give any more specifics. Can someone help me figure out where I've gone wrong? Thanks.
Here is what I am working with:
blockstates file:
{
"forge_marker": 1,
"defaults": {
"model": "forge:multi-layer",
"transform": "forge:default-block"
},
"variants": {
"normal": [{
"custom": {
"base": "mff:backsplash_base#base",
"Solid": "mff:backsplash_base#base",
"Translucent": "mff:backsplash_bricks#trans"
}
}],
"base": [{
"model": "backsplash_base"
}],
"trans": [{
"model": "backsplash_bricks"
}]
}
}
block model file for base:
{
"textures": {
"0": "mff:blocks/white",
"1": "mff:blocks/gemstone_glass",
"2": "mff:blocks/pearl",
"particle": "mff:blocks/gemstone_glass_tile"
},
"elements": [
{
"name": "grout1",
"from": [ 15.0, 15.0, 0.0 ],
"to": [ 16.0, 16.0, 16.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 16.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 16.0 ] }
}
},
{
"name": "grout 4",
"from": [ 15.0, 11.0, 0.0 ],
"to": [ 16.0, 12.0, 16.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 16.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 16.0 ] }
}
},
{
"name": "grout 7",
"from": [ 15.0, 7.0, 0.0 ],
"to": [ 16.0, 8.0, 16.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 16.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 16.0 ] }
}
},
{
"name": "grout 10",
"from": [ 15.0, 3.0, 0.0 ],
"to": [ 16.0, 4.0, 16.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 16.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 16.0 ] }
}
},
{
"name": "Cube",
"from": [ 15.0, 12.0, 0.0 ],
"to": [ 16.0, 15.0, 1.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
}
},
{
"name": "Cube",
"from": [ 15.0, 12.0, 8.0 ],
"to": [ 16.0, 15.0, 9.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
}
},
{
"name": "Cube",
"from": [ 15.0, 8.0, 12.0 ],
"to": [ 16.0, 11.0, 13.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
}
},
{
"name": "Cube",
"from": [ 15.0, 8.0, 4.0 ],
"to": [ 16.0, 11.0, 5.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
}
},
{
"name": "Cube",
"from": [ 15.0, 4.0, 0.0 ],
"to": [ 16.0, 7.0, 1.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
}
},
{
"name": "Cube",
"from": [ 15.0, 4.0, 8.0 ],
"to": [ 16.0, 7.0, 9.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
}
},
{
"name": "Cube",
"from": [ 15.0, 0.0, 12.0 ],
"to": [ 16.0, 3.0, 13.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
}
},
{
"name": "Cube",
"from": [ 15.0, 0.0, 4.0 ],
"to": [ 16.0, 3.0, 5.0 ],
"faces": {
"north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"south": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] },
"down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 1.0 ] }
}
},
{
"name": "base",
"from": [ 0.0, 0.0, 0.0 ],
"to": [ 15.0, 16.0, 16.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 15.0, 16.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 15.0, 16.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 15.0, 16.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 15.0, 16.0 ] }
}
}
]
}
block model file for front (transparent) part:
{
"textures": {
"0": "mff:blocks/gemstone_glass",
"particle": "mff:blocks/gemstone_glass_tile"
},
"elements": [
{
"name": "brick 1",
"from": [ 15.0, 12.0, 9.0 ],
"to": [ 16.0, 15.0, 16.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] }
}
},
{
"name": "brick 2",
"from": [ 15.0, 12.0, 1.0 ],
"to": [ 16.0, 15.0, 8.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] }
}
},
{
"name": "brick 3",
"from": [ 15.0, 8.0, 13.0 ],
"to": [ 16.0, 11.0, 16.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }
}
},
{
"name": "brick 4",
"from": [ 15.0, 8.0, 5.0 ],
"to": [ 16.0, 11.0, 12.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] }
}
},
{
"name": "brick 5",
"from": [ 15.0, 8.0, 0.0 ],
"to": [ 16.0, 11.0, 4.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 4.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 4.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 4.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 4.0 ] }
}
},
{
"name": "brick 6",
"from": [ 15.0, 4.0, 9.0 ],
"to": [ 16.0, 7.0, 16.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] }
}
},
{
"name": "brick 7",
"from": [ 15.0, 4.0, 1.0 ],
"to": [ 16.0, 7.0, 8.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] }
}
},
{
"name": "brick 8",
"from": [ 15.0, 0.0, 13.0 ],
"to": [ 16.0, 3.0, 16.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 3.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] }
}
},
{
"name": "brick 9",
"from": [ 15.0, 0.0, 5.0 ],
"to": [ 16.0, 3.0, 12.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 7.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 7.0 ] }
}
},
{
"name": "brick 10",
"from": [ 15.0, 0.0, 0.0 ],
"to": [ 16.0, 3.0, 4.0 ],
"faces": {
"north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 4.0, 3.0 ] },
"south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 3.0 ] },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 4.0, 3.0 ] },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 4.0 ] },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 4.0 ] }
}
}
]
}
and lastly, the block class file:
package maideniles.fancyfurnishings.blocks;
import maideniles.fancyfurnishings.Reference;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBreakable;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockBacksplash extends BlockFurnishing {
public BlockBacksplash(String unlocalizedName, String registryName){
super(Material.GLASS);
this.setUnlocalizedName(unlocalizedName);
this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName));
}
@Override
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
{
return layer == BlockRenderLayer.TRANSLUCENT || layer == BlockRenderLayer.SOLID;
}
}