Devan-Kerman / ARRP

A fabric api for creating resources and assets at runtime
Mozilla Public License 2.0
104 stars 27 forks source link

JWhen only supports "OR" blockstates, not "AND". #74

Closed T0paz closed 2 years ago

T0paz commented 2 years ago

I'm trying to dynamically generate the blockstates for iron bars, which uses multipart. Below is an example part I need to translate:

{
      "when": {
        "north": "true",
        "west": "false",
        "south": "false",
        "east": "false"
      },
      "apply": {
        "model": "minecraft:block/iron_bars_cap"
      }
    },

However, if I try to add the same using JWhen, its serialization dictates that it's not possible to have multiple "AND" conditions met like found in vanilla. Instead, if I write the following:

JState.multipart(new JBlockModel(getCapModelId(blockId))).when(new JWhen()
                                .add("north", "true")
                                .add("west", "false")
                                .add("south", "false")
                                .add("east", "false"))

It's serialized as:

{   "when": { "OR": [
                { "north": "true" },
                { "west": "false" },
                { "south": "false" },
                { "east": "false" },
                ]}

Or something like that. I don't see any way for it to not be "OR", so let me know if I'm missing something or if this hasn't been done yet.

Devan-Kerman commented 2 years ago

I swear I fixed this, will do

Devan-Kerman commented 2 years ago

wait, does minecraft even have an "AND"?

Devan-Kerman commented 2 years ago

image wiki says no

Devan-Kerman commented 2 years ago

nvm, can't read, added in next update

Devan-Kerman commented 2 years ago

0.6.4