Creating a Directory with a Mixinto?


#1

So if, for example, I try to use a mixinto to put a .qbinto the stonehearth furniture folder, but instead of just saying stonehearth/entities/furniture, put stonehearth/entities/furniture/my_own_furniture/

Would that essentially make a new folder?


#2

stonehearth/entities/furniture is just a hard disk location. It’s the manifest that ‘runs everything’.

If you want to add a piece of furniture you need to create an aliases entry in the manifest for it

   "aliases" : { 
         "furniture:new_furniture" : "file(*new furniture.json path in your mod directory*)",

For example:

  "furniture:comfy_bed_green" : "file(/entities/furniture/comfy_bed_green)",

I want to create a comfy green bed. When my recipe is completed by a crafter it creates an item called modname:furniture:comfy_green_bed. Because that’s what I have specified in the recipe which I have mixinto’d the recipe.json for that crafter.

The manifest is checked, and it tells the game to load the .json file in file/entities/furniture/comfy_green_bed/ (where file is the location of the reference / in this case the root of my mod).

in this case it will look in mymod/entities/furniture/comfy_green_bed/ for a file called comfy_green_bed.json. This is because I haven’t specifically named a .json file to look for.

Hope this helps


#3

Wow, thanks, no idea it worked like that. That clears alot of things up, thanks!So the only thing you actually have to mixinto is the recipe.json? Cool. Hopefully I can figure this out.


#4

It took me a little while to get my head around this, so lets make an item.

I want to make an item. I want it to be a hot air balloon. I have created the models in qubicle and now I want to add them to the game as a craftable recipe.

I have created a folder called mymod and because of personal preference, I have created the subfolders.

So I have

mymod
mymod/professions/carpenter/recipes
mymod/entities/decoration/hot_air_balloon

The first thing I need to do is create the item which I have decided to place in entities/decoration/hot_air_balloon. In this folder I will place two files which I will have created:

hot_air_balloon.qb (this is the model I want to display in the game)
hot_air_balloon_iconic.qb (this is the model I want to display in the stockpile)

In order to create the.qb files, I opened the original hot_air_balloon.qmo file and exported it as a .qb file with axis right. While I’m here I also create a render of it and save it as hot_air_balloon.png inside the decorations/hot_air_balloon folder.

Now I want to tell the game what to do with this awesome model I have created once it is in the game.

To do that I need 3 files:

hot_air_balloon.json
hot_air_balloon_ghost.json
hot_air_balloon_iconic.json

I create a file called hot_air_balloon.json using notepad. In it I put:

{
   "mixins": "file(hot_air_balloon_ghost.json)",
   "components": {
        "stonehearth:entity_forms" : {
        "iconic_form" : "file(hot_air_balloon_iconic.json)",
        "ghost_form" : "file(hot_air_balloon_ghost.json)",
        "placeable_on_ground" : true
  },
  "region_collision_shape": {
     "region": [
        {
           "min" : { "x" : -1, "y" : 0, "z" : -2 },
           "max" : { "x" :  2, "y" : 2, "z" : -1 }
        },
        {
           "min" : { "x" : -1, "y" : 0, "z" : -1 },
           "max" : { "x" :  2, "y" : 1, "z" :  2 }
        },
        {
           "min" : { "x" : -1, "y" : 0, "z" : 2 },
           "max" : { "x" :  2, "y" : 2, "z" : 3 }
        }
     ]
  },
  "destination": {
     "region": [
        {
           "min" : { "x" : -1, "y" : 0, "z" : -1 },
           "max" : { "x" :  2, "y" : 1, "z" :  2 }
        }
     ]
     }
   }
}

Then I create hot_air_balloon.ghost.json

{
   "type": "entity",
   "components": {
   "unit_info": {
     "name": "Hot Air Balloon",
     "description": "I dreamed... a balloon."
  },
  "model_variants": {
     "default": {
        "models": [
           "file(hot_air_balloon.qb)"
        ]
     }
  },
  "stonehearth:material" : {
     "tags" : "wood decoration crafted"
  },
  "render_info" : {
     "scale" : 0.22
  },
  "mob" : {
     "model_origin" : { "x": 0, "y": 0, "z": 0 },
     "region_origin" : { "x": 0.5, "y": 0, "z": 0.5 }
     }
   }
}

and finally I create hot_air_balloon_iconic.json

 {
   "mixins": "stonehearth:mixins:item_properties",
   "components": {
  "model_variants": {
     "default": {
        "models": [
           "file(hot_air_balloon.qb)"
        ]
     }
  },
  "mob" : {
     "model_origin" : { "x": -0.05, "y": 0, "z": 0 },
     "region_origin" : { "x": 0.5, "y": 0, "z": 0.5 }
  }
  }
}

Now that the game knows what to do with the hot air balloon, I need to tell it where to find it:

In the mymod folder I created earlier I create a manisfest.json file

In this file I put:

 {
     "info" @ {
         "name" : "mymod"
  },
  "aliases" : {
         "decoration:hot_air_balloon" : "file(entities/decoration/hot_air_balloon)
  }
}

This tells the game that if any action requires it to create a decoration:hot_air_balloon it should look in mymod/entities/decoration/hot_air_balloon/ for a file called hot_air_balloon.json.

Now all I need to do is tell the game how to create the item, and which profession will create it. I’ve decided that the carpenter will create the hot air balloon. This means that I will have to create a recipe for the hot air balloon in /mymod/professions/carpenter/recipes.

I navigate to the recipes folder and create a file called hot_air_balloon_recipe.json. In it I put:

 {
   "type":"recipe",
   "work_units"  : 2,
   "recipe_name" : "Hot Air Balloon",
   "description" : "Weeeeeee!.",
   "flavor"      : "So much fun!.",
   "portrait"    : "/mymod/entities/decoration/hot_air_balloon/hot_air_balloon.png",

   "ingredients": [
  {
     "material" : "wood resource",
     "count" : 1
  },
  {
     "material" : "cloth resource",
     "count" : 1
  }
  ],
  "produces": [
      {
         "item":"mymod:decoration:hot_air_balloon"
      }
  ]
}

This is a recipe that will create a decoration:hot_air_balloon which we put in the manifest earlier. It points to the portrait picture which we created earlier (for the recipe list) and it tells the game that it needs 1 wood and 1 cloth to complete it.

Then, I need to update the games recipe list so that it knows about the recipe.

In the same folder as the hot_air_balloon_recipe I have just created, I create a file called recipes.json. In it I put:

{
  "craftable_recipes" : {
    "Signage & Decoration" : {
         "hot_air_balloon" : {
                 "uri"   :  "file(hot_air_balloon_recipe.json)"
          }
   }
}
}

Finally… I have to mix the new recipes.json file I have created in to the stonehearth carpenter recipe list.

Opening up the manifest I add the following to the existing aliases:

 {
     "info" @ {
         "name" : "mymod"
  },
  "aliases" : {
         "decoration:hot_air_balloon" : "file(entities/decoration/hot_air_balloon)"
  },
  "mixintos" : {
          "stonehearth/professions/carpenter/recipes/recipes.json" : ["file(professions/carpenter/recipes/recipes.json)" ]
   }
}

That’s pretty much all the steps you need to do to mod in your hot air ballon.

Disclaimer! I am very tired, and I am typing this on the fly. There are probably lots of errors, but it should give you an idea of how to progress.


#5

And in the time it took to write this, it looks like you figured it out anyway :P. Hopefully it will still be of some use for others starting out.


#6

Actually I thought I figured it, out, looks like I over looked about 3 .json I NEED TO RELEASE A HOTFIX! IM SCARED.help me

Seriously though, starting from scratch with your tutorial there.


#7

I have 1 correction, I think it should be recipes.json instead of recipe.json? (Note the “s”)


#8

Correct, and fixed 20char


#9

What is “20char”? Cus I followed your tut exactly, but stonehearth won’t launch. (Pretty sure its a little syntax error)


#10

It’s an issue with the manifest if it wont lauch. 20char was just to get past the 20 character limit…


#11

Oh :smile: twentychar


#12

This is the manifest,

{
“info” @ {
“name” : “hotairballoonmod”
},
“aliases” : {
“decoration:falcon_of_freedom” : "file(entities/decoration/falcon_of_freedom)
},
“mixintos” : {
“stonehearth/professions/carpenter/recipes/recipes.json” : [“file(professions/carpenter/recipes/recipes.json)” ]
}
}

EDIT: I think I have to remove the @ symbol, just realized. XD

EDITEDIT: Still won’t launch


#13

missing " at the end of the “falcon_of_freedom” line


#14

Thanks! TWENTY STPUID CHARACTERS :wink:


#15

Also, I beleive there is a } missing in the recipes.json


#16

OkI fixed all the below errors, and it works.