Jump to content

Submodel Variants?


Draco18s

Recommended Posts

So I have a submodel that I'm using to represent some TE data and just changed from it being a boolean property to an integer (0-6).  I'm perfectly happy copy-pasting the submodel json file 5 times and supplying slight variations on each, however I wanted to ask if it was possible to have variants in the model and just query that instead.

 

My blockstate file looks like this atm:

 

"salt_level": {
            "6": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt6" }
                }
            },
            "5": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt5" }
                }
            },
            "4": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt4" }
                }
            },
            "3": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt3" }
                }
            },
            "2": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt2" }
                }
            },
            "1": {
                "submodel": {
                    "saltblock":  { "model": "harderfarming:salt1" }
                }
            },
            "0": {}
        }

 

Where each of those submodels would look like:

 

{
    "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
    "textures": {
        "0": "harderfarming:blocks/saltblock"
    },
    "elements": [
        {
            "name": "salt",
            "from": [ 5.0, 0.0, 5.0 ], 
            "to": [ 11.0, 6.0, 11.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
                "east": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
                "south": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
                "west": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
                "up": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] },
                "down": { "texture": "#0", "uv": [ 5.0, 5.0, 11.0, 11.0 ] }
            }
        }
    ]
}

 

Only that the "to" and UV values will differ slightly.

 

I was just wondering if there was a cleaner/simpler way to do this.

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

I'm not sure this will work, but maybe you can try to pas arguments to it like you with models. Like for example in a wall:

 

"submodel": {"wall_north": {"model": "wall_side","uvlock": true}}

 

So i would try this:

"submodel": {"wall_north": {"model": "wall_side","uvlock": true},"var1":0, "var2":1}

 

If i check this with the jsonlint it doesn't give errors so that's alright. Don't know if it will work.

I would try it like this.

Link to comment
Share on other sites

Mmmm....nope.  Typed like that the game through a "could not find variant" message caused by "Not a JSON Object: 6.0".  Shoving the var1/var2 stuff inside the } just to the left (so it was part of the submodel declaration) threw "Expected to[1] to be a Float, was "#height"" message instead.

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

If each model has a different "to", then I think you need to stick to separate model files.

 

That's what I figured, thought I'd ask.

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

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Exception in thread "main" java.lang.IllegalStateException: Current Java is 1.8.0_271 but we require at least 17         at net.minecraftforge.bootstrap.shim.Main.main(Main.java:32) Never have successfully gotten a minecraft server up and running so I thought i'd try again. Instant unfixable issue.  
    • What MC version? What's the IP? Are any mods needed to be able to join?
    • Thank you for your answer ! Unfortunatly i have the same problem when i use setPos() public static int movingfunction(CommandContext<CommandSourceStack> context){ CommandSourceStack source = context.getSource(); if (!(source.getEntity() instanceof ServerPlayer)) { return 0; } ServerPlayer player = (ServerPlayer ) source.getEntity(); double moveSpeed = 0.5; for (int i =0; i<10000;i++) { LOGGER.info("running for the {} time", i); double x = player.getX() + player.getViewVector(1.0f).x * moveSpeed; double y = player.getY(); double z = player.getZ() + player.getViewVector(1.0f).z * moveSpeed ; Vec3 movementVec = new Vec3(x, y, z); LOGGER.info("x ={} y ={} z ={}", x, y, z); player.setPos( movementVec); } return 1; } With the logs i can see that x and z are increasing but once again my player is not moving. is there a function to use to sync the server and the client ? I also tried to use LocalPlayer instead of ServerPlayer but my code would stop when i got the object. Also i will change a bit the main topic but is there a way to similate key press ? i found KeyBinding.setKeyBindState on others post but it look like there is no more KeyBinding in 1.20   I found this code : KeyMapping.click(Minecraft.getInstance().options.keyUp.getKey()); But it doesn't seems to work   And i found this one : Minecraft.getInstance().options.keyUp.setDown(true); wich works but doesn't exactly do what i want , it doesn't release the key so for exemple i can't make him run. Minecraft.getInstance().options.keyUp.setDown(true); Minecraft.getInstance().options.keyUp.setDown(false); Minecraft.getInstance().options.keyUp.setDown(true); doesn't make him run
    • Add crash-reports with sites like https://paste.ee/ Maybe an issue with blur, essentials or cumulus_menus
  • Topics

×
×
  • Create New...

Important Information

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