Replacing a model

I want to replace an iconic model from the game, withy one of my own. for the sake of mod/game consistency.
Now in my previous mod question thread, @BrunoSupremo said that mixins override the already existing stuff when it mixins text. Like this:

{ “text” : “new” }
mixed into
{ “text” : “original” }
{ “text” : “new” }

I hoped this would work with a { “model” : “file(model)” }-format as well, and it worked, sort of. When I stamped the model I saw both the old and the new model spawned in simultaneously.

Is there a (maybe entirely different) way to do this?

They way I set it up in order to replace an iconic model, is by writing code as seen below in the entity json-file:

"components": {
	  "stonehearth:entity_forms": {
         "iconic_form": "file(tombstone_iconic.json)",
         "ghost_form": "file(tombstone_ghost.json)",
         "placeable_on_ground": true

In the tombstone_iconic.json, I have code as seen below:

   "mixins": "stonehearth:mixins:item_properties",
   "type": "entity",
   "components": {
      "model_variants": {
         "default": {
            "models": [

I only see my version of the iconic model - no duplicates.
Hopefully this code can bring you some ideas, @nikosthefan.

So the first one is a mixin, then? If so, I understand what you mean.

Ah, yes - indeed this is the case :slight_smile:

1 Like

It worked. I also cut out all the stuff I didn’t want to replace (the “placable_on_gound”, “type” and “mixins” for instance), and it still works, so you can cut it out of you mod without worries. (faster loading time, for what it is worth).

Thanks @Hamnisu

You got two models because that is what a mixin does. It fuses two codes into one. When you have a [ … ] every thing inside the list is a item. With a mixin or mixinto, you are just adding one more there. That is why you end up with two models.

In the old thread when I said the mixin replaces code, I was referring to the “text”:“your text here”. Only text and numbers are replaced. Everything else is added like in this case now, where it was not a text, but an item in a list.

The code show above by Hamnisu is not a mixin for the iconic. It is telling which file has the iconic, without blending them. If it was a mixin, the contents would fuse in that file and that would not work because the game expects it to be on its own file.
What you did was creating a full new file just for the iconic form of entity. It works, but was not needed.

Are you trying to change an iconic from a item already in the game that is not part of your mod?
Then you could simple override the model.

In the manifest:


Any time - I’m glad my limited experiences with Stonehearth-modding could be somewhat useful for you, too!

Ah, this is true. As always, great information and provided example, @BrunoSupremo!

Oh, that is interesting, I will try it.

It works, thanks. Always useful to learn new things! :smile:

"components": {
	"stonehearth:entity_forms": {
		"iconic_form": "file(tombstone_iconic.json)",
		"ghost_form": "file(tombstone_ghost.json)",
		"placeable_on_ground": true

To clarify the above code:
The game has no way to guess where the iconic file and its information of your object is. It can’t even know if the objects actually needs an iconic. For example, trees don’t have an iconic, nor a ghost.
That is why we use that entity_forms component. It is our way to inform the game, hey this entity has an iconic and it is in this file.

When we see that a json of an entity has in the top of its file a line like:
“mixin”: "link to its own ghost file"
It is just a way for us lazy coders to reuse code that would be repeated, like the display name or even the models. We are not defining the ghost file. That is done on that entity_forms component.