Jump to content

[Solved] [1.16.4] - forge:multi-layer block rendering issue


JDL

Recommended Posts

Hello, I have a block that contains Translucent and Cutout parts, I've created the blockstate, model and changed the render layer to accept any renderType.

Unfortunately the block only renders properly on my inventory, when placed on the ground the block renders all parts correctly but also contains a cube with the missing texture around it.

 

 

Here is the code for the model:

{
	"textures": {
		"0": "block/iron_block",
		"1": "cranknika:blocks/tank_glass",
		"2": "block/white_concrete",
		"3": "cranknika:blocks/water_still",
		"particle": "block/iron_block"
	},
	"display": {
		"thirdperson_righthand": {
			"rotation": [75, 45, 0],
			"translation": [0, 2.5, 0],
			"scale": [0.375, 0.375, 0.375]
		},
		"thirdperson_lefthand": {
			"rotation": [75, 45, 0],
			"translation": [0, 2.5, 0],
			"scale": [0.375, 0.375, 0.375]
		},
		"firstperson_righthand": {
			"rotation": [0, 45, 0],
			"scale": [0.4, 0.4, 0.4]
		},
		"firstperson_lefthand": {
			"rotation": [0, 225, 0],
			"scale": [0.4, 0.4, 0.4]
		},
		"ground": {
			"translation": [0, 3, 0],
			"scale": [0.25, 0.25, 0.25]
		},
		"gui": {
			"rotation": [30, 225, 0],
			"scale": [0.625, 0.625, 0.625]
		},
		"fixed": {
			"scale": [0.5, 0.5, 0.5]
		}
	},
	"groups": [
		{
			"name": "Translucent",
			"origin": [9, 10, 9],
			"children": [0]
		},
		{
			"name": "Cutout",
			"origin": [8, 8, 8],
			"children": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
		}
	],
	"loader": "forge:multi-layer",
	"layers": {
		"cutout": {
			"textures": {
				"0": "block/iron_block",
				"1": "cranknika:blocks/tank_glass",
				"2": "block/white_concrete",
				"3": "cranknika:blocks/water_still",
				"particle": "block/iron_block"
			},
			"elements": [
				{
					"from": [10, 15, 10],
					"to": [12, 16, 12],
					"rotation": {"angle": 0, "axis": "y", "origin": [19, 23, 19]},
					"faces": {
						"north": {"uv": [0, 0, 2, 1], "texture": "#2"},
						"east": {"uv": [0, 0, 2, 1], "texture": "#2"},
						"south": {"uv": [0, 0, 2, 1], "texture": "#2"},
						"west": {"uv": [0, 0, 2, 1], "texture": "#2"},
						"up": {"uv": [0, 0, 2, 2], "texture": "#2"},
						"down": {"uv": [0, 0, 2, 2], "texture": "#2"}
					}
				},
				{
					"from": [2, 13, 0],
					"to": [14, 15, 1],
					"rotation": {"angle": 0, "axis": "y", "origin": [4, 9, -7]},
					"faces": {
						"north": {"uv": [2, 1, 14, 3], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"south": {"uv": [0, 0, 12, 2], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"up": {"uv": [0, 0, 12, 1], "texture": "#0"},
						"down": {"uv": [0, 0, 12, 1], "texture": "#0"}
					}
				},
				{
					"from": [0, 15, 0],
					"to": [16, 16, 1],
					"rotation": {"angle": 0, "axis": "y", "origin": [4, 11, -7]},
					"faces": {
						"north": {"uv": [0, 0, 16, 1], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 1], "texture": "#0"},
						"south": {"uv": [0, 0, 16, 1], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 1], "texture": "#0"},
						"up": {"uv": [0, 0, 16, 1], "texture": "#0"},
						"down": {"uv": [0, 0, 16, 1], "texture": "#0"}
					}
				},
				{
					"from": [0, 15, 15],
					"to": [16, 16, 16],
					"rotation": {"angle": 0, "axis": "y", "origin": [4, 11, 8]},
					"faces": {
						"north": {"uv": [0, 0, 16, 1], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 1], "texture": "#0"},
						"south": {"uv": [0, 0, 16, 1], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 1], "texture": "#0"},
						"up": {"uv": [0, 15, 16, 16], "texture": "#0"},
						"down": {"uv": [0, 0, 16, 1], "texture": "#0"}
					}
				},
				{
					"from": [1, 0, 1],
					"to": [15, 1, 15],
					"rotation": {"angle": 0, "axis": "y", "origin": [4, -5, 7]},
					"faces": {
						"north": {"uv": [0, 0, 14, 1], "texture": "#0"},
						"east": {"uv": [0, 0, 14, 1], "texture": "#0"},
						"south": {"uv": [0, 0, 14, 1], "texture": "#0"},
						"west": {"uv": [0, 0, 14, 1], "texture": "#0"},
						"up": {"uv": [0, 0, 14, 14], "texture": "#0"},
						"down": {"uv": [1, 1, 15, 15], "texture": "#0"}
					}
				},
				{
					"from": [1, 14, 1],
					"to": [15, 15, 15],
					"rotation": {"angle": 0, "axis": "y", "origin": [4, 9, 7]},
					"faces": {
						"north": {"uv": [0, 0, 14, 1], "texture": "#0"},
						"east": {"uv": [0, 0, 14, 1], "texture": "#0"},
						"south": {"uv": [0, 0, 14, 1], "texture": "#0"},
						"west": {"uv": [0, 0, 14, 1], "texture": "#0"},
						"up": {"uv": [1, 1, 15, 15], "texture": "#0"},
						"down": {"uv": [0, 0, 14, 14], "texture": "#0"}
					}
				},
				{
					"from": [2, 13, 15],
					"to": [14, 15, 16],
					"rotation": {"angle": 0, "axis": "y", "origin": [4, 9, 8]},
					"faces": {
						"north": {"uv": [0, 0, 12, 2], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"south": {"uv": [2, 1, 14, 3], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"up": {"uv": [0, 0, 12, 1], "texture": "#0"},
						"down": {"uv": [0, 0, 12, 1], "texture": "#0"}
					}
				},
				{
					"from": [2, 2, 15],
					"to": [14, 13, 15],
					"rotation": {"angle": 0, "axis": "y", "origin": [4, -2, 7]},
					"faces": {
						"north": {"uv": [0, 0, 12, 11], "texture": "#1"},
						"east": {"uv": [0, 0, 0, 11], "texture": "#1"},
						"south": {"uv": [0, 0, 12, 11], "texture": "#1"},
						"west": {"uv": [0, 0, 0, 11], "texture": "#1"},
						"up": {"uv": [0, 0, 12, 0], "texture": "#1"},
						"down": {"uv": [0, 0, 12, 0], "texture": "#1"}
					}
				},
				{
					"from": [2, 2, 1],
					"to": [14, 13, 1],
					"rotation": {"angle": 0, "axis": "y", "origin": [4, -2, -7]},
					"faces": {
						"north": {"uv": [0, 0, 12, 11], "texture": "#1"},
						"east": {"uv": [0, 0, 0, 11], "texture": "#1"},
						"south": {"uv": [0, 0, 12, 11], "texture": "#1"},
						"west": {"uv": [0, 0, 0, 11], "texture": "#1"},
						"up": {"uv": [0, 0, 12, 0], "texture": "#1"},
						"down": {"uv": [0, 0, 12, 0], "texture": "#1"}
					}
				},
				{
					"from": [2, 0, 0],
					"to": [14, 2, 1],
					"rotation": {"angle": 0, "axis": "y", "origin": [4, -4, -7]},
					"faces": {
						"north": {"uv": [2, 14, 14, 16], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"south": {"uv": [0, 0, 12, 2], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"up": {"uv": [0, 0, 12, 1], "texture": "#0"},
						"down": {"uv": [0, 0, 12, 1], "texture": "#0"}
					}
				},
				{
					"from": [2, 0, 15],
					"to": [14, 2, 16],
					"rotation": {"angle": 0, "axis": "y", "origin": [4, -4, 8]},
					"faces": {
						"north": {"uv": [0, 0, 12, 2], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"south": {"uv": [2, 14, 14, 16], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"up": {"uv": [0, 0, 12, 1], "texture": "#0"},
						"down": {"uv": [0, 0, 12, 1], "texture": "#0"}
					}
				},
				{
					"from": [0, 0, 0],
					"to": [2, 15, 1],
					"rotation": {"angle": 0, "axis": "y", "origin": [-4, 8, -7]},
					"faces": {
						"north": {"uv": [14, 0, 16, 15], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
						"south": {"uv": [0, 0, 2, 15], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
						"up": {"uv": [0, 0, 2, 1], "texture": "#0"},
						"down": {"uv": [0, 0, 2, 1], "texture": "#0"}
					}
				},
				{
					"from": [0, 0, 15],
					"to": [2, 15, 16],
					"rotation": {"angle": 0, "axis": "y", "origin": [-4, 8, 8]},
					"faces": {
						"north": {"uv": [0, 0, 2, 15], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
						"south": {"uv": [0, 0, 2, 15], "texture": "#0"},
						"west": {"uv": [15, 0, 16, 15], "texture": "#0"},
						"up": {"uv": [0, 0, 2, 1], "texture": "#0"},
						"down": {"uv": [0, 0, 2, 1], "texture": "#0"}
					}
				},
				{
					"from": [0, 0, 14],
					"to": [1, 16, 15],
					"rotation": {"angle": 0, "axis": "y", "origin": [-7, 8, 5]},
					"faces": {
						"north": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"south": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"west": {"uv": [14, 0, 15, 16], "texture": "#0"},
						"up": {"uv": [0, 14, 1, 15], "texture": "#0"},
						"down": {"uv": [0, 0, 1, 1], "texture": "#0"}
					}
				},
				{
					"from": [15, 0, 14],
					"to": [16, 16, 15],
					"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 5]},
					"faces": {
						"north": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"south": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"up": {"uv": [15, 14, 16, 15], "texture": "#0"},
						"down": {"uv": [0, 0, 1, 1], "texture": "#0"}
					}
				},
				{
					"from": [0, 0, 1],
					"to": [1, 16, 2],
					"rotation": {"angle": 0, "axis": "y", "origin": [-7, 8, -8]},
					"faces": {
						"north": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"south": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"west": {"uv": [1, 0, 2, 16], "texture": "#0"},
						"up": {"uv": [0, 1, 1, 2], "texture": "#0"},
						"down": {"uv": [0, 0, 1, 1], "texture": "#0"}
					}
				},
				{
					"from": [15, 0, 1],
					"to": [16, 16, 2],
					"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, -8]},
					"faces": {
						"north": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"south": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 16], "texture": "#0"},
						"up": {"uv": [0, 1, 1, 2], "texture": "#0"},
						"down": {"uv": [0, 0, 1, 1], "texture": "#0"}
					}
				},
				{
					"from": [14, 0, 15],
					"to": [16, 15, 16],
					"faces": {
						"north": {"uv": [0, 0, 2, 15], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
						"south": {"uv": [14, 0, 16, 15], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
						"up": {"uv": [0, 0, 2, 1], "texture": "#0"},
						"down": {"uv": [0, 0, 2, 1], "texture": "#0"}
					}
				},
				{
					"from": [14, 0, 0],
					"to": [16, 15, 1],
					"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, -7]},
					"faces": {
						"north": {"uv": [0, 0, 2, 15], "texture": "#0"},
						"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
						"south": {"uv": [0, 0, 2, 15], "texture": "#0"},
						"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
						"up": {"uv": [0, 0, 2, 1], "texture": "#0"},
						"down": {"uv": [0, 0, 2, 1], "texture": "#0"}
					}
				},
				{
					"from": [15, 0, 2],
					"to": [16, 2, 14],
					"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, -6]},
					"faces": {
						"north": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"east": {"uv": [2, 14, 14, 16], "texture": "#0"},
						"south": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"west": {"uv": [0, 0, 12, 2], "texture": "#0"},
						"up": {"uv": [0, 0, 1, 12], "texture": "#0"},
						"down": {"uv": [0, 0, 1, 12], "texture": "#0"}
					}
				},
				{
					"from": [15, 2, 2],
					"to": [15, 13, 14],
					"rotation": {"angle": 0, "axis": "y", "origin": [8, 10, -6]},
					"faces": {
						"north": {"uv": [0, 0, 0, 11], "texture": "#1"},
						"east": {"uv": [0, 0, 12, 11], "texture": "#1"},
						"south": {"uv": [0, 0, 0, 11], "texture": "#1"},
						"west": {"uv": [0, 0, 12, 11], "texture": "#1"},
						"up": {"uv": [0, 0, 0, 12], "texture": "#1"},
						"down": {"uv": [0, 0, 0, 12], "texture": "#1"}
					}
				},
				{
					"from": [1, 2, 2],
					"to": [1, 13, 14],
					"rotation": {"angle": 0, "axis": "y", "origin": [-6, 10, -6]},
					"faces": {
						"north": {"uv": [0, 0, 0, 11], "texture": "#1"},
						"east": {"uv": [0, 0, 12, 11], "texture": "#1"},
						"south": {"uv": [0, 0, 0, 11], "texture": "#1"},
						"west": {"uv": [0, 0, 12, 11], "texture": "#1"},
						"up": {"uv": [0, 0, 0, 12], "texture": "#1"},
						"down": {"uv": [0, 0, 0, 12], "texture": "#1"}
					}
				},
				{
					"from": [0, 0, 2],
					"to": [1, 2, 14],
					"rotation": {"angle": 0, "axis": "y", "origin": [-7, 8, -6]},
					"faces": {
						"north": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"east": {"uv": [0, 0, 12, 2], "texture": "#0"},
						"south": {"uv": [0, 0, 1, 2], "texture": "#0"},
						"west": {"uv": [2, 14, 14, 16], "texture": "#0"},
						"up": {"uv": [0, 0, 1, 12], "texture": "#0"},
						"down": {"uv": [0, 0, 1, 12], "texture": "#0"}
					}
				},
				{
					"from": [15, 13, 2],
					"to": [16, 16, 14],
					"rotation": {"angle": 0, "axis": "y", "origin": [8, 21, -6]},
					"faces": {
						"north": {"uv": [0, 0, 1, 3], "texture": "#0"},
						"east": {"uv": [2, 0, 14, 3], "texture": "#0"},
						"south": {"uv": [0, 0, 1, 3], "texture": "#0"},
						"west": {"uv": [0, 0, 12, 3], "texture": "#0"},
						"up": {"uv": [15, 2, 16, 14], "texture": "#0"},
						"down": {"uv": [0, 0, 1, 12], "texture": "#0"}
					}
				},
				{
					"from": [0, 13, 2],
					"to": [1, 16, 14],
					"rotation": {"angle": 0, "axis": "y", "origin": [-7, 21, -6]},
					"faces": {
						"north": {"uv": [0, 0, 1, 3], "texture": "#0"},
						"east": {"uv": [2, 15, 14, 16], "texture": "#0"},
						"south": {"uv": [0, 0, 1, 3], "texture": "#0"},
						"west": {"uv": [2, 0, 14, 3], "texture": "#0"},
						"up": {"uv": [0, 2, 1, 14], "texture": "#0"},
						"down": {"uv": [0, 0, 1, 12], "texture": "#0"}
					}
				}
			]
		},
		"translucent": {
			"textures": {
				"0": "block/iron_block",
				"1": "cranknika:blocks/tank_glass",
				"2": "block/white_concrete",
				"3": "cranknika:blocks/water_still",
				"particle": "block/iron_block"
			},
			"elements": [
				{
					"name": "water",
					"from": [2, 1, 2],
					"to": [14, 3, 14],
					"rotation": {"angle": 0, "axis": "y", "origin": [9, 10, 9]},
					"faces": {
						"north": {"uv": [1, 7, 13, 9], "texture": "#3"},
						"east": {"uv": [0, 0, 12, 2], "texture": "#3"},
						"south": {"uv": [0, 0, 12, 2], "texture": "#3"},
						"west": {"uv": [0, 0, 12, 2], "texture": "#3"},
						"up": {"uv": [2, 2, 14, 14], "texture": "#3"},
						"down": {"uv": [0, 0, 12, 12], "texture": "#3"}
					}
				}
			]
		}
	}
}

Blockstate:

{
  "variants": {
    "": { "model": "cranknika:block/multi" }
  }
}

Render type:

    private void clientSetup(final FMLClientSetupEvent event)
    {
        RenderTypeLookup.setRenderLayer(BlockInit.TANK.get(), renderType -> true);
    }

 

I have no errors in the console, I've tried everything but I can't seem to find an answer, forge's documentation is really bad.

 

Thanks in advance!

weird_rendering.jpg

interior.png

Edited by JDL
Issue solved
Link to comment
Share on other sites

After learning how to work with predicates I was able to set the block only to render as Cutout and Translucent, that removed the strange behavior documented above.

 

Here is the code for anyone interested:

 

    private void clientSetup(final FMLClientSetupEvent event)
    {
        RenderTypeLookup.setRenderLayer(BlockInit.TANK.get(), (layer) -> layer == RenderType.getCutout() || layer == RenderType.getTranslucent());
    }

 

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.



×
×
  • Create New...

Important Information

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