Jump to content

[1.15.2] Help streamlining this JSON for orientation and redstone power level


_KyleL

Recommended Posts

Hi,

 

Can someone help me thin this JSON out? I feel like it's way too robust, but at the same time, I'm struggling to find how to do it. I saw that Forge had it's own blockstates in 1.14, but they have since been removed apparently.

 

Also, side problem - when the block is placed facing up or down, it is always in the same orientations regarding NSEW. Is it possible to have it rotate depending on facing up and north vs up and east etc. without stretching this JSON even further?

 

Full github at: https://github.com/KLitjens/IndicatorBlock

 

{
  "variants": {
    "power=0,facing=north":{ "model": "test:block/indicator_block"},
    "power=0,facing=east":{ "model": "test:block/indicator_block", "y":  90},
    "power=0,facing=south":{ "model": "test:block/indicator_block", "y":  180},
    "power=0,facing=west":{ "model": "test:block/indicator_block", "y":  270},
    "power=0,facing=up":{ "model": "test:block/indicator_block", "x":  90},
    "power=0,facing=down":{ "model": "test:block/indicator_block", "x":  270},
    "power=1,facing=north":{ "model": "test:block/indicator_block_power1"},
    "power=1,facing=east":{ "model": "test:block/indicator_block_power1", "y":  90},
    "power=1,facing=south":{ "model": "test:block/indicator_block_power1", "y":  180},
    "power=1,facing=west":{ "model": "test:block/indicator_block_power1", "y":  270},
    "power=1,facing=up":{ "model": "test:block/indicator_block_power1", "x":  90},
    "power=1,facing=down":{ "model": "test:block/indicator_block_power1", "x":  270},
    "power=2,facing=north":{ "model": "test:block/indicator_block_power2"},
    "power=2,facing=east":{ "model": "test:block/indicator_block_power2", "y":  90},
    "power=2,facing=south":{ "model": "test:block/indicator_block_power2", "y":  180},
    "power=2,facing=west":{ "model": "test:block/indicator_block_power2", "y":  270},
    "power=2,facing=up":{ "model": "test:block/indicator_block_power2", "x":  90},
    "power=2,facing=down":{ "model": "test:block/indicator_block_power2", "x":  270},
    "power=3,facing=north":{ "model": "test:block/indicator_block_power3"},
    "power=3,facing=east":{ "model": "test:block/indicator_block_power3", "y":  90},
    "power=3,facing=south":{ "model": "test:block/indicator_block_power3", "y":  180},
    "power=3,facing=west":{ "model": "test:block/indicator_block_power3", "y":  270},
    "power=3,facing=up":{ "model": "test:block/indicator_block_power3", "x":  90},
    "power=3,facing=down":{ "model": "test:block/indicator_block_power3", "x":  270},
    "power=4,facing=north":{ "model": "test:block/indicator_block_power4"},
    "power=4,facing=east":{ "model": "test:block/indicator_block_power4", "y":  90},
    "power=4,facing=south":{ "model": "test:block/indicator_block_power4", "y":  180},
    "power=4,facing=west":{ "model": "test:block/indicator_block_power4", "y":  270},
    "power=4,facing=up":{ "model": "test:block/indicator_block_power4", "x":  90},
    "power=4,facing=down":{ "model": "test:block/indicator_block_power4", "x":  270},
    "power=5,facing=north":{ "model": "test:block/indicator_block_power5"},
    "power=5,facing=east":{ "model": "test:block/indicator_block_power5", "y":  90},
    "power=5,facing=south":{ "model": "test:block/indicator_block_power5", "y":  180},
    "power=5,facing=west":{ "model": "test:block/indicator_block_power5", "y":  270},
    "power=5,facing=up":{ "model": "test:block/indicator_block_power5", "x":  90},
    "power=5,facing=down":{ "model": "test:block/indicator_block_power5", "x":  270},
    "power=6,facing=north":{ "model": "test:block/indicator_block_power6"},
    "power=6,facing=east":{ "model": "test:block/indicator_block_power6", "y":  90},
    "power=6,facing=south":{ "model": "test:block/indicator_block_power6", "y":  180},
    "power=6,facing=west":{ "model": "test:block/indicator_block_power6", "y":  270},
    "power=6,facing=up":{ "model": "test:block/indicator_block_power6", "x":  90},
    "power=6,facing=down":{ "model": "test:block/indicator_block_power6", "x":  270},
    "power=7,facing=north":{ "model": "test:block/indicator_block_power7"},
    "power=7,facing=east":{ "model": "test:block/indicator_block_power7", "y":  90},
    "power=7,facing=south":{ "model": "test:block/indicator_block_power7", "y":  180},
    "power=7,facing=west":{ "model": "test:block/indicator_block_power7", "y":  270},
    "power=7,facing=up":{ "model": "test:block/indicator_block_power7", "x":  90},
    "power=7,facing=down":{ "model": "test:block/indicator_block_power7", "x":  270},
    "power=8,facing=north":{ "model": "test:block/indicator_block_power8"},
    "power=8,facing=east":{ "model": "test:block/indicator_block_power8", "y":  90},
    "power=8,facing=south":{ "model": "test:block/indicator_block_power8", "y":  180},
    "power=8,facing=west":{ "model": "test:block/indicator_block_power8", "y":  270},
    "power=8,facing=up":{ "model": "test:block/indicator_block_power8", "x":  90},
    "power=8,facing=down":{ "model": "test:block/indicator_block_power8", "x":  270},
    "power=9,facing=north":{ "model": "test:block/indicator_block_power9"},
    "power=9,facing=east":{ "model": "test:block/indicator_block_power9", "y":  90},
    "power=9,facing=south":{ "model": "test:block/indicator_block_power9", "y":  180},
    "power=9,facing=west":{ "model": "test:block/indicator_block_power9", "y":  270},
    "power=9,facing=up":{ "model": "test:block/indicator_block_power9", "x":  90},
    "power=9,facing=down":{ "model": "test:block/indicator_block_power9", "x":  270},
    "power=10,facing=north":{ "model": "test:block/indicator_block_power10"},
    "power=10,facing=east":{ "model": "test:block/indicator_block_power10", "y":  90},
    "power=10,facing=south":{ "model": "test:block/indicator_block_power10", "y":  180},
    "power=10,facing=west":{ "model": "test:block/indicator_block_power10", "y":  270},
    "power=10,facing=up":{ "model": "test:block/indicator_block_power10", "x":  90},
    "power=10,facing=down":{ "model": "test:block/indicator_block_power10", "x":  270},
    "power=11,facing=north":{ "model": "test:block/indicator_block_power11"},
    "power=11,facing=east":{ "model": "test:block/indicator_block_power11", "y":  90},
    "power=11,facing=south":{ "model": "test:block/indicator_block_power11", "y":  180},
    "power=11,facing=west":{ "model": "test:block/indicator_block_power11", "y":  270},
    "power=11,facing=up":{ "model": "test:block/indicator_block_power11", "x":  90},
    "power=11,facing=down":{ "model": "test:block/indicator_block_power11", "x":  270},
    "power=12,facing=north":{ "model": "test:block/indicator_block_power12"},
    "power=12,facing=east":{ "model": "test:block/indicator_block_power12", "y":  90},
    "power=12,facing=south":{ "model": "test:block/indicator_block_power12", "y":  180},
    "power=12,facing=west":{ "model": "test:block/indicator_block_power12", "y":  270},
    "power=12,facing=up":{ "model": "test:block/indicator_block_power12", "x":  90},
    "power=12,facing=down":{ "model": "test:block/indicator_block_power12", "x":  270},
    "power=13,facing=north":{ "model": "test:block/indicator_block_power13"},
    "power=13,facing=east":{ "model": "test:block/indicator_block_power13", "y":  90},
    "power=13,facing=south":{ "model": "test:block/indicator_block_power13", "y":  180},
    "power=13,facing=west":{ "model": "test:block/indicator_block_power13", "y":  270},
    "power=13,facing=up":{ "model": "test:block/indicator_block_power13", "x":  90},
    "power=13,facing=down":{ "model": "test:block/indicator_block_power13", "x":  270},
    "power=14,facing=north":{ "model": "test:block/indicator_block_power14"},
    "power=14,facing=east":{ "model": "test:block/indicator_block_power14", "y":  90},
    "power=14,facing=south":{ "model": "test:block/indicator_block_power14", "y":  180},
    "power=14,facing=west":{ "model": "test:block/indicator_block_power14", "y":  270},
    "power=14,facing=up":{ "model": "test:block/indicator_block_power14", "x":  90},
    "power=14,facing=down":{ "model": "test:block/indicator_block_power14", "x":  270},
    "power=15,facing=north":{ "model": "test:block/indicator_block_power15"},
    "power=15,facing=east":{ "model": "test:block/indicator_block_power15", "y":  90},
    "power=15,facing=south":{ "model": "test:block/indicator_block_power15", "y":  180},
    "power=15,facing=west":{ "model": "test:block/indicator_block_power15", "y":  270},
    "power=15,facing=up":{ "model": "test:block/indicator_block_power15", "x":  90},
    "power=15,facing=down":{ "model": "test:block/indicator_block_power15", "x":  270}
  }
}

 

Link to comment
Share on other sites

Forge blockstates were removed because vanilla is smarter now.

 

Quote

Vanilla blockstate jsons are smarter now

  • Before: the variant string was expected in a very specific format: alphabetized list of propertyname=value pairs, based on the statemapper
  • Now: the string is split on "," and dynamically built into a Predicate<IBlockState>. This obsoletes statemapper ignoring since if you don't care about changing rendering for a given property, just don't specify it in the blockstate json
  • How overlapping predicates are handled is unknown, but from brief investigation it seems to be an error.
  • Side effect: the "normal" variant should now be named "", defining a predicate that matches all incoming IBlockStates

https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a

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.

Link to comment
Share on other sites

Howdy

I think - if your json works, just leave it as is.  A long json isn't a problem really, and it could take you hours to figure out a "more efficient" method.

If you are very keen - you could take inspiration from redstone wire.  They change the colour based on the power as well, using multistates to build up appearance based on properties.

 

-TGG

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.