Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

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.

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.

  • Author

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.