Jump to content

Recommended Posts

Posted

Howdy! Big fan of VS and everything that's going on in the modding community to the point that I am dipping my toes in to see what's up.

I have found an outdated mod that I want to update so it works with 1.21, maybe even learn enough to futureproof it, who knows? But I'm definitely struggling.

The mod in question is: https://mods.vintagestory.at/hangingbaskets

What seems to be the trouble is with the constructor that makes the final hanging basket product. It seems related to the grid recipe, but I am not familiar enough with how all of these files interact with each other to know what might be at fault. Further, is there some kind of major change documentation that could point out differences going from 1.19 to 1.21? Apologies if this is buried in the tutorials somewhere and I'm too impatient to find them, I also just generally wanted to say hi and join the fun!

The bit of code throwing all of my errors: 

[
  {
    "ingredientPattern": "R,P",
    "height": 2,
    "width": 1,
    "ingredients": {
      "P": { "type": "block", "code": "game:flowerpot-*", "name": "kind" },    #### <- my initial impression is that this changed during a version update so it breaks the constructor
      "R": { "type": "item", "code": "game:rope" }
    },
    "output": {
      "type": "block",
      "code": "hangingflowerpot-{kind}"
    },
    "copyAttributesFrom": "P"
  },
  {
    "ingredientPattern": "P",
    "height": 1,
    "width": 1,
    "ingredients": {
      "P": {
        "type": "block",
        "code": "hangingflowerpot-*",
        "name": "kind",
        "returnedStack": { "type": "item", "code": "game:rope" }
      }
    },
    "output": {
      "type": "block",
      "code": "game:flowerpot-{kind}"
    },
    "copyAttributesFrom": "P"
  }
]

 

Posted (edited)
1 hour ago, wblueskylives said:

Further, is there some kind of major change documentation that could point out differences going from 1.19 to 1.21?

Your best bet is probably the dev log, particularly the API changes. However, those will not mention everything. Going from 1.20 to 1.21 for example, clay assets were split up into two separate files, one for raw and one for fired items.

You are right about your hunch. The aforementioned change breaks the recipe. In 1.20 the recipe would have resolved

"P": { "type": "block", "code": "game:flowerpot-*", "name": "kind" },

into

"P": { "type": "block", "code": "game:flowerpot-(raw|burnt|amber|boneash|celadon|copper|earthern|moss|ochre|rutile|seasalt|tenmoku", "name": "kind" },

all of which will be saved into the variable "kind" and carry over into "hangingflowerpot-{kind}". This worked because the asset codes line up with the variantgroups in "hangingflowerpot.json" shown below (With the exception of raw, this might have been handled by code, but I have never used the mod before, so maybe it always produced the errors in the logs.)

Spoiler
"variantgroups": [
    {
      "code": "type",
      "states": [
        "burnt",
        "amber",
        "boneash",
        "celadon",
        "copper",
        "earthern",
        "moss",
        "ochre",
        "rutile",
        "seasalt",
        "tenmoku"
      ]
    }
  ],

With the changes to the clay items in 1.21 now the recipe ingredient flowerpot will resolve into

"P": { "type": "block", "code": "game:flowerpot-(blue|fire|black|brown|cream|gray|orange|red|tan)-(raw|fired)", "name": "kind" },

which doesn't line up with the hangingflowerpots variantgroups at all. Those items simply do not exist, and that's why you are getting those error messages.

The fix might be as simple as simply overwriting the hangingflowerpots variantgroups with the game:flowerpots variantgroups. It could also involve some more changes to the code the mod is using. I am not a coder, so unfortunately I cannot help you in this regard.

Edited by Brady_The
  • Like 1
Posted (edited)

Stellar reply and greatly appreciated! Exactly the kind of hint I needed. I noticed too that there is the additional flowerpot-fancy which is what the original recipes seem to allude to. Back to these mines I go

Edit: Already making progress! I've got a semi-working recipe and it only crashes when trying to UNcraft! Beautiful!

Edited by wblueskylives
  • Like 2
Posted

Ugh, clearly deeper issues here than what I thought. Trying to update the block variants has apparently broken all of the texture paths. Also the original set of pots this was setup for seems to have moved to the "flowerpot-fancy" category. Strugglebus ahoy!

Posted
13 minutes ago, wblueskylives said:

Ugh, clearly deeper issues here than what I thought. Trying to update the block variants has apparently broken all of the texture paths. Also the original set of pots this was setup for seems to have moved to the "flowerpot-fancy" category. Strugglebus ahoy!

Most keys can make use of {variables} to shorten things. Instead of creating a dozen texture definitions for dozen of variations, you can do create simply one and the game will automatically fill in the variables.

The flowerpots variantgroup code was changed from "type" to "color". You can simply copy the "texture" key from the vanilla file and should be fine. Don't forget to add the "game:" domain in front of the paths, though.

  • Like 1
Posted
13 minutes ago, Brady_The said:

Most keys can make use of {variables} to shorten things. Instead of creating a dozen texture definitions for dozen of variations, you can do create simply one and the game will automatically fill in the variables.

The flowerpots variantgroup code was changed from "type" to "color". You can simply copy the "texture" key from the vanilla file and should be fine. Don't forget to add the "game:" domain in front of the paths, though.

Brilliant, another one for you while you're around:

Frustratingly, the reed basket portion of this mod works without a hitch, graphics and disassemble included. I believe I'm honing in on the recipes and the formatting of all of that being the problem child here, and my thought is to just get -one- working fully and scale from there. The question in all of this being, do you think it's better to create an individual recipe for each of these, or would wildcards potentially futureproof/make this more of a capable mod? Maybe those are larger questions that we two can answer..

Posted
34 minutes ago, wblueskylives said:

The question in all of this being, do you think it's better to create an individual recipe for each of these, or would wildcards potentially futureproof/make this more of a capable mod?

Most modders using wildcards will make use of "allowedVariants" to restrict combinations. If the devs or another mod should decided to add a green clay to the game for example, your mod would (not break) but it would print error messages, because it would encounter the same problem you have been facing, simply because "hangingflowerpot-green-fired" doesn't exist.

Posted

I had the (eventual) idea to pop open some other mods that are doing similar things to see how other folks are doing stuff on this version, that's led me a new point! Fully functional hanging plant recipes including dismantling without crashing the game! Textures though are not functional yet. My initial foray into that has left me with a single texture being applied regardless of the input type. This has ALSO caused a delightful destruction of any surrounding textures AND the inability to remove the block as a whole. 

Definitely a fresh head-scratcher for tomorrow morning with some coffee, a great time of trying to reverse engineer all of this though lol

Hope everyone's weekend is going well   ♪(^∇^*)

  • Like 1
Posted
51 minutes ago, wblueskylives said:

Alas, @LastHazzerd beat me to the punch and has left a lovely foundation to work from. https://mods.vintagestory.at/show/mod/29587#tab-description

That's how it goes sometimes. 😄

Still, I think this was/is a worthwhile exercise. It might be a good idea to go through the modding tutorials on the wiki: https://wiki.vintagestory.at/Special:MyLanguage/Modding:Modding_Basics_Portal They are great. That's how I got started.

There are still a lot of abandoned mods out there. Your opportunity will come!

  • Like 2
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.