Jump to content

Recommended Posts

Posted (edited)

Hello,

How can I make a multilayer block model?

With that I mean I specify the texture of layer 1 and layer 2 and layer 2 gets rendered on top of layer 1.

I've tried:

{
	"parent": "block/cube_all",
	"textures": {
		"all": "blocks/stone",
		"overlay": "dgm:blocks/cheese_ore"
	},
	"elements": [
		{
			"from": [ 0, 0, 0 ],
			"to": [ 16, 16, 16 ],
			"faces": {
				"down":  { "texture": "#overlay", "cullface": "down" },
				"up":    { "texture": "#overlay", "cullface": "up" },
				"north": { "texture": "#overlay", "cullface": "north" },
				"south": { "texture": "#overlay", "cullface": "south" },
				"west":  { "texture": "#overlay", "cullface": "west" },
				"east":  { "texture": "#overlay", "cullface": "east" }
			}
		}
	]
}

But that only renders the overlay and the transparency in it white.

Then I tried making the block opaque etc. and that ended up making the transparency transparent without the other layer:

public class CheeseOre extends Block {
	public CheeseOre(Material materialIn) {
		super(materialIn);
	}

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

	@Override
	public boolean isFullCube(IBlockState state) {
		return false;
	}

	@Override
	public boolean isOpaqueCube(IBlockState state) {
		return false;
	}
}

So how can I do it?

Edited by Kokkie

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted

Add more elements with a different texture reference.

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

No, you overwrote block/cube_all's elements. You didn't add, you replaced.

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

You can't. The "elements" tag is specifically a replacement. Actually all named tags are replacements. Its just that in some cases (like the "display" tag on items*) that things aren't replaced, and it has to do with how the files are deserialized.

 

You MUST add all 6 sides to your model twice, each with a different texture. There is no way around this.

 

*This reason this is true is because "display" is an object. Each subtag present replaces the parent's original. "elements" is a list and there's no way to know that the element list you've supplied should add or replace the parent's list, so the default action is replace (if the default was add there would be no ability to replace).

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 (edited)

Now, the purple/black texture appears. My new block model:

{
	"parent": "block/block",
	"textures": {
		"block": "blocks/stone",
		"ore": "dgm:blocks/cheese_ore",
		"particle": "blocks/stone"
	},
	"elements": [
		{
			"from": [ 0, 0, 0 ],
			"to": [ 16, 16, 16 ],
			"faces": {
				"down":  { "texture": "#block", "cullface": "down" },
				"up":    { "texture": "#block", "cullface": "up" },
				"north": { "texture": "#block", "cullface": "north" },
				"south": { "texture": "#block", "cullface": "south" },
				"west":  { "texture": "#block", "cullface": "west" },
				"east":  { "texture": "#block", "cullface": "east" }
			}
		},
		{
			"from": [ 0, 0, 0 ],
			"to": [ 16, 16, 16 ],
			"faces": {
				"down":  { "texture": "#overlay", "cullface": "down" },
				"up":    { "texture": "#overlay", "cullface": "up" },
				"north": { "texture": "#overlay", "cullface": "north" },
				"south": { "texture": "#overlay", "cullface": "south" },
				"west":  { "texture": "#overlay", "cullface": "west" },
				"east":  { "texture": "#overlay", "cullface": "east" }
			}
		}
	]
}

The console and client log give no errors.

Edited by Kokkie

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted

Couple things:

1) Your overlay texture is #overlay, you didn't specify a resource location (this is likely the problem).

2) You haven't specified any UV coordinates. You probably don't need them, but it's good form to have them.

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.

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.