A lot of questions aliases/overrides/mixintos

Maybe my english is just to bad to fully understand how these commands work.

If theres is a good How To i would appreciate lining it to me or correct me if im wrong

aliases:
aliases are for my mod only they don`t enter the original aliases in the stonehearth manifest and are not referred to from the original code
correct ?

overrides:
overrides overwriite a whole file in the stonehearth.smod with the file i give in to it
correct ?

mixintos:
I thought mixintos add some command lines to an existing .json but IĀ“m not sure if i understood that correctly.

Example
(After i dropped the snowhare project, i thought of something ā€œeasierā€)
I`m trieing to add the ā€œfineā€ crafted stone_chair

  1. i copied the stone chair files,
  2. changed every path into stone_chair_fine (same as in the castle_door example)
  3. added an aliases in my manifest to refer to the furniture:stone_chair:fine (like the carpenter furniture names)
  4. checked that there`s a chance of having ā€œfineā€ craftet masonry work in mason_desription.json
  5. tried to ā€œmixintosā€ a command line in the original ā€œstone_chair.jsonā€ to refer to my furniture:stone_chair:fine

but the only error i get is
there`s no aliases in furniture for stone_chair:fine

So please explain these commands to me and lead me out of the darkness i`m in

Aliases are for your mod only, so while a base game alias would be, for example, stonehearth:category:item, yours would be YourMod:category:item. They are entered in ā€œmods/yourMod/manifest.jsonā€

Correct! Overrides replace data from other jsons with whatever is in your json.

Mixintos mix your code into existing jsons. Itā€™s recommended to use mixintos when modding, as overrides change the code in the base game. Basically a mixinto contains the parts of the json youā€™d like to change with the values youā€™d like to add/modify.

For your example, could you maybe post your mixinto and manifest code here?
I might not be able to help you, but its worth a look. The more apt coders here would definitely be able to help!

before i post my mod commands i got a new question about mixinto

How can i add the following single line into the stone_chair_recipe
"fine":ā€œfurniture:stone_chair:fineā€

this is the example from the comfy_chair
{
ā€œtypeā€:ā€œrecipeā€,
ā€œwork_unitsā€ : 3,
ā€œrecipe_nameā€ : ā€œComfy Chairā€,
ā€œdescriptionā€ : ā€œIts padded seat guarantees a 98% reducion in awkward splinters!ā€,
ā€œflavorā€ : ā€œIf pillows are good for the head, surely theyā€™re even better for the butt and back!ā€,
ā€œportraitā€ : ā€œ/stonehearth/entities/furniture/comfy_chair/comfy_chair.pngā€,
ā€œlevel_requirementā€ : 2,
ā€œingredientsā€: [
{
ā€œuriā€ : ā€œstonehearth:furniture:simple_wooden_chairā€,
ā€œcountā€ : 1
},
{
ā€œmaterialā€ : ā€œcloth resourceā€,
ā€œcountā€ : 1
}
],
ā€œproducesā€: [
{
ā€œitemā€:ā€œstonehearth:furniture:comfy_chairā€,
ā€œfineā€:ā€œstonehearth:furniture:comfy_chair:fineā€
}
]
}

the problem is, if i repeat a single line of the json a lua error occurs.
I tried it like this
{
ā€œfineā€:ā€œfurniture:stone_chair:fineā€
}
But no effect and no error.

@phector2004
about the manifest
im trieing a workaround with a mixinto into the original manifest with my aliases. Theres no error code in the log files maybe it works can`t tell by now

try this:

{
    "produces": [
        {
            "fine":"yourmodhere:furniture:stone_chair:fine" 
        }
    ]
}

json is a markup language like html. When you want to mixinto a new tag:value pair, you have to nest it in the same way as you intend it to be nested in the final file. Your code is placing the information in the wrong place in the file.

When using an alias, you also need to include the name of your mod at the front. I wrote ā€œyourmodhereā€, but that should be whatever you named your mod. An alias always starts with the name of the mod it is in. This is why in the code from the comfy chair, it uses ā€œstonehearth:furniture:comfy_chairā€ and not ā€œfurniture:comfy_chairā€.

@Tuhalu
that was my first thought and i tried it but you get this lua error in return
2015-Jun-21 17:55:46.723836 | client | 0 | lua.code | std::logic_error: 'data mode object 2being registered twice.'
because of the double ā€œproducesā€ in the code

Hmm. I checked it out myself and there seems to be some kind of bug there. If you do it how I wrote before, you get the error you describe (and it wonā€™t load). If you use the following, it runs, but when you craft a stone chair, it produces two stone chairs a time (although sometimes youā€™ll get a fine version on one of the chairs after level 3).

{
    "produces": [
        {
            "item":"stonehearth:furniture:stone_chair",
            "fine":"yourmodhere:furniture:stone_chair:fine" 
        }
    ]
}

@Froggyā€™s Stonehearth Cafe does almost the exact same thing with a mixinto to a ā€œā€ : [] style command. He adds new crop types with it. It is really strange that it fails here.

the stonehearth cafe mod (which is great) is mostly stand alone (i read it for hours now) and is referencing 99% to itself so there are no problems
but the stone chair (and the rabbitā€¦see my other topic) is referring to the stonehearth original code and often to the lua scripts
i just try to work it out and not using overrides

@Tuhalu
interesting normally it should produce a stone_chair after checking the chance of producing fine
(checking crafter_component.luac line103)

Ok adding my aliases to the stonehearth manifest isn`t working if i understand this right
(and the stone chair is always referring to the original manifest)
lua.code | ā€“ Script Error (lua) Begin -------------------------------
2015-Jun-21 19:09:21.186328 | server | 0 | lua.code | std::exception: ā€˜ā€˜stonehearthā€™ has no alias named ā€˜furniture:stone_chair:fineā€™ in the manifest.ā€™

and as often its the create_entity function in
radiant/models/entities.luac
but my lua knowledge is very little so i can`t figure it out why

It shouldnā€™t be looking for stonehearth:furniture:stone_chair:fine

It should be looking for mymod:furnture:stone_chair:fine, no?

Iā€™ve pmā€™d you a dropbox file request to upload your mod, so I can take a look at it. (You donā€™t require Dropbox to use it)

2 Likes

I hope Iā€™m understanding correctly: You shouldnā€™t be trying to mix your aliases into the ā€˜stonehearthā€™ manifest. Your mod has its own manifest in its main folder. This will automatically be loaded when you run the game, and its where you should put all of your aliases.

The reason youā€™re getting that error is because ā€˜stonehearthā€™ the gameā€™s main ā€˜modā€™ doesnā€™t have your item in it. Youā€™ll be better off adding your item to your modā€™s manifest and leaving the base game files untouched.

Have your previous mods worked? As a suggestion, @honestabelink had put a nice tutorial up a few months ago. If you havenā€™t made a mod before, it can show you how to add a basic item, from which point you can tinker and find out how to make it a ā€˜fineā€™ item:

Youā€™re having mostly problems when trying to mix your items with existing stonehearth items.

I tried the other day to add the critters (as I have ones) but I didnā€™t see them being trapped despite setting several trappers and lots of large trapping areas. After a couple of in-game days, some of my critters should have been trapped, but I only saw the current existing critters. Maybe thereā€™s something wrong with the code.