Jump to content

Recommended Posts

Posted

Is it possible to define a variant for a block inside of another variant using the Forge Blockstate JSON?

 

As an example, I'm adding custom stairs to Minecraft, but in order to allow inner stairs and outer stairs the y needs to change based on which direction the stair block is facing AND which type of stairs it is (inner, outer, or straight).

 

Is it possible to define this using the Forge Blockstate JSON?

 

(Here's the JSON i'm currently using which doesn't rotate the block correctly for inner stairs:

Spoiler

{
  "forge_marker": 1,
  "defaults": {
    "textures": {
      "bottom": "blocks/glass",
      "top": "blocks/glass",
      "side": "blocks/glass"
    },
    "model": "expanded:stairs/stairs_alternate",
    "uvlock": true
  },
  "variants": {
    "inventory": {
      "model": "expanded:stairs/stairs_alternate"
    },
    "facing": {
      "north": {
        "y": 270
      },
      "east": {
        "y": 0
      },
      "south": {
        "y": 90
      },
      "west": {
        "y:": 180
      }
    },
    "half": {
      "bottom": {
        "x": 0
      },
      "top": {
        "x": 180
      }
    },
    "shape": {
      "straight": {
        "model": "expanded:stairs/stairs_alternate"
      },
      "outer_right": {
        "model": "expanded:stairs/stairs_alternate_outer"
      },
      "outer_left": {
        "model": "expanded:stairs/stairs_alternate_outer"
      },
      "inner_right": {
        "model": "expanded:stairs/stairs_alternate_inner"
      },
      "inner_left": {
        "model": "expanded:stairs/stairs_alternate_inner"
      }
    }
  }
}

 

 

Posted (edited)

Forge's blockstates format only allows you to specify the effects of individual property values or fully-defined variants, you can't specify the effects of a subset of properties (e.g. two of three properties).

 

You also can't specify the x and y rotation separately, if you specify one then the other will be 0 for that variant.

 

You could use an IStateMapper to have a different blockstates file for each value of one of the properties or use Vanilla's multipart blockstates format; but I think you may be best off with a single Forge blockstates file with fully-defined variants.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.