Jump to content

[1.10] MissingVariantException


TITANJC

Recommended Posts

Been beating my head against the wall for a while on this one.

 

I am creating a block that should change it's model based on whether or not it is next to another one.

 

However I'm having this error and I can't seem to figure out what's going on.

 

Here is a single instance of the error

http://pastebin.com/eEja2LJT

 

There are four block models

shelf_center_oak.json

shelf_left_oak.json

shelf_right_oak.json

shelf_single_oak.json

 

My BlockShelf.json (BlockState)

http://pastebin.com/8c1sx859

 

and finally my BlockShelf.java class

http://pastebin.com/AhAvZtcw

 

Any insight would be greatly appreciated. Though I am not yet familiar with the inner workings of MinecraftForge, nor would I call myself a Java expert, I am a Software Engineer and perfectly ok with Googling something i don't understand in your answer :)

TitanCraft is coming... This will be updated with a link once available

Link to comment
Share on other sites

That's not how Forge's blockstates format works. The format is documented here.

 

The

defaults

section can only contain the same values as a single variant would, it can't have multiple variants in it.

 

Each key in the

variants

section can either be a fully-defined variant (e.g.

connections=4,facing=east

or

normal

) or a property name (e.g.

connections

).

 

The value of a fully-defined variant key can either be an array of variants (in which case one will be chosen at random when the model is rendered) or a single variant (must not have an object as the first value, otherwise the deserialiser won't recognise it as a fully-defined variant).

 

The value of a property name key must be an object that maps each value of the property to a variant.

 

You can see some examples of the format here, here and here.

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.

Link to comment
Share on other sites

Awesome, thank you for the examples. I took a step away for a bit and while talking with my niece it suddenly occurred to me that I was thinking of the BlockState json in totally the wrong way.

 

This is what I have now. and though I'm changing the model in the wrong directions it is working, and that's a simple fix.

 

[EDIT] had my left and right backwards

 

{
  "forge_marker": 1,
  "defaults": {
    "model": "titancraft:shelf_single_oak"
  },
  "variants": {
    "connections": {
      "1": {
        "model": "titancraft:shelf_right_oak"
      },
      "2": {
        "model": "titancraft:shelf_left_oak"
      },
      "3": {
        "model": "titancraft:shelf_center_oak"
      },
      "4": {
        "model": "titancraft:shelf_single_oak"
      }
    },
    "facing": {
      "north": {

      },
      "east": {
        "y": 90
      },
      "south": {
        "y": 180
      },
      "west": {
        "y": 270
      }
    }
  }
}

 

TitanCraft is coming... This will be updated with a link once available

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.

Announcements



×
×
  • Create New...

Important Information

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