# Pawel's Mod Corner: Autoharvest, Biome Crops, LostEms & others

**URL:** <https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504>\
**Category:** Current Mods\
**Created:** [November 2, 2016, 6:33pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504 "2016-11-02T18:33:49Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 8, 2017, 4:20pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/66 "2017-10-08T16:20:05Z")

</div>

for the translation - it wasnt that difficult xD i have just add his line via mix in my translation of stonehearth en.json ^^

but what i dont understand that is the error - when the lines are completly the same why i get this error even with vanilla? or was ometing changed on v 763?

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 8, 2017, 8:26pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/67 "2017-10-08T20:26:18Z")

</div>

> [@BrunoSupremo](#):
>
> Nah, don’t worry, palm trees are not available outside the archipelago biome anyway.

They are in Plant Lore - you can buy any seeds from the Herbalist merchant. But Plant Lore uses Pawel API now so this is not a problem anymore.

> [@BrunoSupremo](#):
>
> You overcomplicated your locales and made it hard for translators (surprised Wiese didn’t mentioned this yet). You made one en.json, and added it to the stonehearth through mixins. Just having the locales folder is enough for it to be readable by the game, and then you change your strings from i18n(stonehearth:… to i18n(pawel\_API:…

For me it is easier because: I don’t need to keep tracking where I should use `stonehearth:...` and where `mod_name:...` and I can put both new texts and overrides of vanilla ones in one file. But I understand the difficulty and I’ll change that in next backward-incompatible releases of my mods (at least for Finetems one is coming out as soon as I find a way to allow choosing model variants when placing an object so all shuttered windows are one entity with variants instead of a crowded mess).

I guess Wiese didn’t mention it yet because my mods are not that popular (as of now about 25 downloads each). I don’t have enough time to make screenshots so I don’t get much attention, I prefer testing my mods properly instead (and yet most mods are still quite buggy…).

> [@BrunoSupremo](#):
>
> And on your spawn\_on\_kill.json you are missing a comma

Thanks, fixed. Fortunately the file is not functional, it just serves as a component template.

> [@BrunoSupremo](#):
>
> Checking your mod, I see that you changed the tags of two items from vegetable to fruit. This can break recipes that were dependent on those tags. Although I agree on the fruit tag, I recommend just adding it instead of replacing the old one.

I tested it, two tags make Hearthlings think they ate both vegetable and fruit. And there still are other fruits (berries) and vegetables (carrots etc.), so this would not break the recipes, just move prickly pears and watermelons to a different ingredient category. Leaving a category empty would be dangerous but it’s not a case here.

---

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 10, 2017, 1:51pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/68 "2017-10-10T13:51:36Z")

</div>

ok i give up ^^ fresh install no mods only api and plant\_lore and i still get this issue … with v763

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 10, 2017, 3:40pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/69 "2017-10-10T15:40:30Z")

</div>

If you’re using the latest versions of the API and Plant Lore then I have no clue what is going on, as you see the error log refers files my code doesn’t touch. I’ve already checked the code and everything is fine.

---

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 10, 2017, 4:44pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/70 "2017-10-10T16:44:11Z")

</div>

hmmm perhaps @max99x can help with this?

here is the freshest logfile - expect from the many finding issues - there is only this issue with the luafile

[stonehearth.log](https://discourse.stonehearth.net/uploads/short-url/asUdFFA4FcfNjSXFfwwQHLqYwF0.log) (36.0 KB)

freshinstall (no settings change) with only the normal ingamemods and api + plant\_lore installed

---

<div class="post-metadata">

**Author:** ![max99x](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/max99x/32/40094_2.png) [@max99x](https://discourse.stonehearth.net/u/max99x)\
**Post date:** [October 10, 2017, 5:12pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/71 "2017-10-10T17:12:06Z")

</div>

> [@Wiese2007](#):
>
> hmmm perhaps @max99x can help with this?

The error is in `pawel_renewable_resource_node_component.lua`, line `216`, which is certainly part of this mod. Whether it’s a bug in the mod itself or an interaction with another mod (the log references other mods) I cannot tell.

---

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 10, 2017, 5:34pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/72 "2017-10-10T17:34:32Z")

</div>

thx for your help ^^ so im not the only one who doesnt understand it xD

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 10, 2017, 7:11pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/73 "2017-10-10T19:11:38Z")

</div>

I wanted to do some stuff the devs usually do by extending engine functionality but then margin removal and autoharvest component started throwing strange error logs at mod users…

The only possible way to index `nil` in line 216 when `player_id` is valid is to remove `Town` class which is a part of town service. Calling `stonehearth.town:get_town(player_id)` would point to a `nil`value then. So it is either a problem with service initialisation, `player_id` input or trace class which if I remember correctly sits in radiant.smod.

Does anyone else have that problem? My last recommendations would be to add Stonehearth to your antivirus whitelist and run Stonehearth as admin.

---

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 10, 2017, 7:29pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/74 "2017-10-10T19:29:02Z")

</div>

ok tested - antivirus firewall and admin - same issue … like i know there is one german player without this issue - he was the one who recommend your mod that i should test and translate it ^^

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 10, 2017, 7:50pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/75 "2017-10-10T19:50:57Z")

</div>

When exactly do you get the error? Every time you start the game? In such case enable only debugtools and pawel\_API and try generating a new world. If the issue persists I think I won’t be able to fix it as it quite frankly doesn’t make sense (at least the error log doesn’t when compared to the code).

This may also suggest a completely different problem: there actually is some kind of an error, but it leaves incorrect log entry or for some reason an error log entry is created while there is no error (a false positive).

---

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 10, 2017, 7:58pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/76 "2017-10-10T19:58:58Z")

</div>

with every testrun i have always started a complete new game - set an plant to be autoharvest my hearthling runs to it and harvest it - after sometime the error occurs just in the moment when the plant is renew/refreshed. so it aboard the autoharvest command i can deactivate and manual reactivate the command and the error shows again after the next respawn. -

jfi the hearthlings dont autoharvest the plant after the error ^^

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 10, 2017, 9:00pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/77 "2017-10-10T21:00:25Z")

</div>

I found a potentially dangerous shortcut in the code responsible for request harvest part you described and it can be tested easily if it causes the error. The workaround is adding a simple `if` statement and changing the source of `player_id` data to the autoharvest component (now it simply grabs it from an entity - what if an entity has no `player_id`?).

Try placing a plant via Item Stamper and see if the error occurs for it. If it fixes the problem then the reason is not line 216 but 182.

---

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 11, 2017, 2:42am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/78 "2017-10-11T02:42:09Z")

</div>

ANNNNDDD THE WINNER IS THE ITEMSTAMPER 😃  
with this it works - no error and my hearthlings do the autoharvest - tested with all vanilla plants

edit: also now tested wit new plants from brewery and settlementdecor - works fine with the stamper

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 11, 2017, 4:47pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/79 "2017-10-11T16:47:31Z")

</div>

OK, fixed, Pawel API alpha 1.0a should have the bug removed. Download link in the first post.

---

<div class="post-metadata">

**Author:** ![Wiese2007](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/wiese2007/32/15946_2.png) [@Wiese2007](https://discourse.stonehearth.net/u/Wiese2007)\
**Post date:** [October 11, 2017, 5:50pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/80 "2017-10-11T17:50:22Z")

</div>

Testrun completed - works fine now 😃 THX^^ Now i will start with the translation of plant lore and finetems ^^

---

<div class="post-metadata">

**Author:** ![Auryanna](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@Auryanna](https://discourse.stonehearth.net/u/Auryanna)\
**Post date:** [October 13, 2017, 4:57pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/81 "2017-10-13T16:57:50Z")

</div>

So I’m a total idiot when it comes to any kind of coding - I’m having issues with Plant Lore - I can’t make an Herbalist as it requires a plant specimen but I can’t pick anything without the Herbalist - I’ve tried actually picking up the plants & having them in inventory but that doesn’t work either - how do I fix this? I read the “unpack the mod” part but how am I to do that to figure out what I need to change?

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 14, 2017, 11:41am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/82 "2017-10-14T11:41:45Z")

</div>

Thanks for the report, I spotted a complex .json problem between Plant Lore and the API while investigating it. Both mods will get an update when I fix all the issues around it as this bug is quite critical (forces you to purchase Herbalist talisman).

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 14, 2017, 1:21pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/83 "2017-10-14T13:21:22Z")

</div>

Ladies and gentlemen, the margin removal bug seems to be gone!

What caused the error was the fact I was mixing into mixin files from stonehearth.smod (door ghost mixins have all margins except the top set to 1). Overriding the files instead of mixing into them works and doesn’t cause the error. At least for me, so I uploaded new version of the API for testing. The lesson is: never mixinto a mixin file.

@Alostlawgrad, @Golden and @Wiese2007: does this version of [pawel\_API.smod](https://discourse.stonehearth.net/uploads/short-url/fdfZswtrVYUVFhYDwvQzva3TDwF.smod) (51.8 KB) fix the bug for you (make sure you have Finetems 1.4 or disable Finetems completely because older versions attempt to remove margins themselves instead of relying on the API)?

Please respond after testing.

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 15, 2017, 9:20am UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/84 "2017-10-15T09:20:00Z")

</div>

So I finally found a way to fix the margin removal bug. It’s more of a workaround than a fix, but it works flawlessly. Overriding a mixin doesn’t work the way I expected and I couldn’t rely on it so the fix is applied to each door\_ghost.json separately and Finetems doors use alternate mixins added to the API. I had to update Finetems and Plant Lore because of the changes so don’t redownload my mods if you don’t want to break saved games.

Also, good news for translators: all my mods now have separate en.json and only en\_correction.json is mixed in if I need to change vanilla texts.

---

<div class="post-metadata">

**Author:** ![Pawel\_Malecki](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/pawel_malecki/32/52928_2.png) [@Pawel\_Malecki](https://discourse.stonehearth.net/u/Pawel_Malecki)\
**Post date:** [October 15, 2017, 2:14pm UTC](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504/86 "2017-10-15T14:14:34Z")

</div>

> [@Auryanna](#):
>
> So I’m a total idiot when it comes to any kind of coding - I’m having issues with Plant Lore - I can’t make an Herbalist as it requires a plant specimen

Results of my investigation are: objects which are not items (have root, ghost and iconic entity forms) cannot be used in recipes with material tags. The only resource which is obtained from plants, doesn’t require the Herbalist and has only one item form is plant fiber so I created an appropriate resource constant and altered the recipes. Fix is applied to Plant Lore alpha 1.1b.

Good news is this should bring the small sub-release shenanigans to the end as all major bugs in the API, Finetems and Plant Lore seem to be fixed for now.

[Previous page](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504.md?page=3)

[Next page](https://discourse.stonehearth.net/t/pawels-mod-corner-autoharvest-biome-crops-lostems-others/26504.md?page=5)
