Mods / BedSpawn

Tags: #QoL #Tweak
Author: ilan
Side: Both
Created: Jun 14th 2024 at 6:15 AM
Last modified: Jan 26th at 9:08 AM
Downloads: 42492
Follow Unfollow 355

Latest release (for outdated Vintage Story v1.20.3):
bedspawnv2_1.4.0.zip  1-click install


A simple mod that sets your spawn point when you use a bed. The spawn point is reset when the bed is destroyed.

Includes a command called /set-fatigue to allow you to set your player's "tiredness" (requires admin).

 

Configuration

  • RequireSneaking - Set to true if you would like to set the spawn only when you use the bed while sneaking.
  • BlacklistedBeds - A list of blacklisted bed block codes that won't set your spawn. Defaults to an empty list.
    If you wish, for example, to add the hay bed to this list - just update the value in the configuration file to ["bed-hay"]

Version For Game version Downloads Release date Changelog Download 1-click mod install*
v1.4.0 25917 Jan 26th at 9:08 AM Show bedspawnv2_1.4.0.zip 1-click install
v1.3.0 6822 Nov 18th 2024 at 4:10 PM Show bedspawnv2_1.3.0.zip 1-click install
v1.2.0 9239 Jun 15th 2024 at 9:14 PM Show bedspawnv2_1.2.0.zip 1-click install
v1.1.0 166 Jun 15th 2024 at 3:03 PM Show bedspawnv2_1.1.0.zip 1-click install
v1.0.0 348 Jun 14th 2024 at 7:56 AM Show bedspawnv2_1.0.0.zip 1-click install

45 Comments (oldest first | newest first)

💬 Ribosom, May 4th at 9:48 AM

Thank you for the mod!

May I ask for a feature request? I would like to see a configurable time in the configuration file for how much time must pass to reset your spawn point with a bed again. Maybe every x days, or once a month. Not sure how easy it is to persist state in Vintage Story mods. The idea is to prevent me from abusing bed respawns. Even if I don't abuse it, the knowledge of being able to use it all the time breaks my survival immersion.
So I am conflicted, I love the bed respawns, but it is so easy to abuse it. I think a time constraint would be a great addition.

💬 ilan , Apr 30th at 4:55 AM

Spiridon I haven't tested it personally but it should!

 

💬 Spiridon, Apr 24th at 4:12 PM

does this work on 1.20.9?

💬 ilan , Apr 9th at 5:17 AM

Drew_555 all beds work by default, did you install the mod correctly?

💬 Drew_555, Apr 6th at 6:09 PM

hey im new to modded vs me and a few mates set up a server and are using this mod but they hay beds seem to not be working on default is that intended and we need to make a wooden one or is somthing wrong with our session

💬 SoggyGravel, Mar 27th at 7:07 AM

seems to be working in 1.20.6

💬 ilan , Feb 28th at 6:39 AM

diegokilla Yeah, the code that resets your spawn point when the bed is destroyed is in the mod. Remove the mod, and your spawn is no longer reset. You will need to use a temporal gear to set your spawn location.

jabes I haven't tested it, but it should work fine.

💬 jabes, Feb 26th at 12:51 AM

Working on 1.20.4?

💬 diegokilla, Feb 21st at 9:09 AM

So we had this mod on our server and took it off, but I continually spawn where my bed was, even if I destroy the bed. I also tried setting the temporalgearrespawn(whatever that command is) to zero and I'm still just respawning where my bed was. Any thoughts? (server spawn is not set where my bed was obviously XD )

 

💬 ilan , Feb 11th at 7:02 AM

DecaByte Sure, I can probably add a configuration option to change the button

💬 DecaByte, Feb 8th at 12:02 AM

I found that I accidentally will hit shift-click on beds. Could you add a config so I can change the key or Ctrl-click instead? That would be helpful.

💬 ilan , Jan 28th at 10:31 AM

Arthemy

Kutaras

Can you share some logs? I've tested with 1.20.3 and it works fine, it could be a game bug in 1.20.1

CKitt

That's really nice to hear, glad you're enjoying the mod! 🙂

💬 CKitt, Jan 27th at 7:04 PM

ilan

I do have AutoConfigLib installed, but there had been no errors prior to this mod being installed. I've disabled AutoConfigLib for now, your mod is more important!

💬 Arthemys, Jan 27th at 3:18 PM

Don't know what sorcery people did to say it works on 1.20.1 for me it doesn't, it throws an exception and blocks me there 😂. 

Just play on 1.20.3 it works there 💪💀

💬 Kutaras, Jan 27th at 3:18 PM

1.19.8 version does not work with 1.20.1 👄👨‍👨‍👦‍👦🏳️‍🌈

💬 ilan , Jan 27th at 7:49 AM

CKitt

Did you update/install AutoConfigLib by any chance? Or did it start happening with this latest version?

In any case, the error is coming from AutoConfigLib's code 😅 

Edit: Yep, after testing myself with my mods and AutoConfigLib, it appears that mod has some issues:

27.1.2025 09:52:54 [Client Error] Failed to load AutoConfigLibConfig.json using default, exception: System.NullReferenceException: Object reference not set to an instance of an object.
at AutoConfigLib.Auto.AutoConfigGenerator.RegisterOrCollectConfigFile[T](ICoreAPI api, String configPath, T configValue) in D:\Modding\VintageStory\AutoConfigLib\AutoConfigLib\Auto\AutoConfigGenerator.cs:line 24
at AutoConfigLib.AutoConfigLibModSystem.StartPre(ICoreAPI api) in D:\Modding\VintageStory\AutoConfigLib\AutoConfigLib\AutoConfigLibModSystem.cs:line 58

💬 CKitt, Jan 26th at 3:28 PM

Thank you! Always a pleasure to have this mod running on my server.

Edit: Uh-oh! I'm not quite sure what's going on here. Incompatibility with AutoConfig?

26.1.2025 09:38:18 [Error] [bedspawnv2] An exception was thrown when trying to start the mod:
26.1.2025 09:38:18 [Error] [bedspawnv2] Exception: Object reference not set to an instance of an object.
at AutoConfigLib.Auto.AutoConfigGenerator.RegisterOrCollectConfigFile[T](ICoreAPI api, String configPath, T configValue) in D:\Modding\VintageStory\AutoConfigLib\AutoConfigLib\Auto\AutoConfigGenerator.cs:line 24
at AutoConfigLib.HarmonyPatches.ConfigInterception.GetConfigOverride[T](ICoreAPICommon api, String fileName) in D:\Modding\VintageStory\AutoConfigLib\AutoConfigLib\HarmonyPatches\ConfigInterception.cs:line 48
at BedSpawn.Configuration.ModConfig.ReadConfig(ICoreAPI api) in D:\Code\VintageStory\VSMods\src\BedSpawn\BedSpawn\Configuration\ModConfig.cs:line 30
at BedSpawn.BedSpawnModSystem.Start(ICoreAPI api) in D:\Code\VintageStory\VSMods\src\BedSpawn\BedSpawn\BedSpawnModSystem.cs:line 25
at Vintagestory.Common.ModLoader.TryRunModPhase(Mod mod, ModSystem system, ICoreAPI api, ModRunPhase phase) in VintagestoryLib\Common\API\ModLoader.cs:line 629
26.1.2025 09:38:18 [Error] Failed to run mod phase Start for mod BedSpawn.BedSpawnModSystem

💬 ilan , Jan 26th at 9:57 AM

I updated the mod for 1.20.3, but there are no real code changes (just changed the game version)

💬 Retromastery, Jan 22nd at 6:22 AM

For those wondering if this mod still works as of 1.20.1

Yes, it still works, tested it and had no issues after 30+ Hours

💬 WildWitchyNanna, Jan 19th at 11:00 AM

Are you working on an update for 1.20? please

💬 EragonArgetlam, Dec 29th 2024 at 11:11 PM

Isochronous

Didn't use the mod yet so not fully sure, but basing on how other mod configs work you have to go to C:\Users\[Username]\AppData\Roaming\VintagestoryData\ModConfig 
and find the config file for this mod, and editting it by openning it in notepad (or other text editor) and looking for the "RequireSneaking:false," and change the false to true or BlacklistedBeds and add the ["bed-hay"] after it.

💬 Isochronous, Dec 29th 2024 at 7:09 PM

hello :) im brand new to the game and have no idea how to edit the banlist/have sneak enable setting spawn. Could anyone help me please :) TYIA

Edit:: I guess im actually asking how to set the configurations? :)

💬 BulletJustice, Nov 19th 2024 at 4:34 PM

"Good idea! I've gone ahead and added that :) "

EPIC, ty so much!

💬 DejFidOFF, Nov 18th 2024 at 6:32 PM

ilan

Hi o/ 1.20 update?

💬 ilan , Nov 18th 2024 at 4:11 PM

Xiarno BulletJustice

Good idea! I've gone ahead and added that :) 

💬 Xiarno, Nov 14th 2024 at 5:31 PM

I agree with BulletJustice. Having "Hold sneak when using bed to set spawn" makes a lot of sense. A config to allow that would be really appreciated if possible!

💬 BulletJustice, Nov 11th 2024 at 6:49 AM

Would it be possible to make it so you can toggle on/off the function via a keybind on client side? blacklisting a bed just doesnt really cut it when there is gate-keeping in progression to what bed you have available. Making a keybind "hold shift when using bed to set spawn" just makes more sense to me, if that would be possible?

💬 ilan , Oct 21st 2024 at 10:11 AM

Omikronlex

The mod config folder is under the %APPDATA%\VintagestoryData\ModConfig folder in Windows.

💬 Omikronlex, Sep 10th 2024 at 11:46 PM

Where would I find the mod settings or the configuration file to blacklist beds?

💬 ilan , Aug 1st 2024 at 8:00 AM

Hi there,

There isn't any command to disable the respawn mechanic as the mod uses the vanilla spawn point system to change your spawn point.

 

However, you can use the "blacklisted beds" configuration in the mod settings to blacklist the hay bed, for example, so you can use a hay bed during your travels, and use a regular wooden bed at home to set your spawn point.

💬 Razvandicoot, Jul 27th 2024 at 3:56 PM

Hi there!

Could anyone tell me if there is a command or key combination to disable the spawn set so I can use another bed while exploring without resetting the spawnpoint?

💬 ilan , Jul 19th 2024 at 8:49 AM

Any bed that implements `BlockBed` will work, but looking at the code for the "storage bed" in Vies Blocks, it seems that they do not.

I could probably add some kind of whitelist for non-bed blocks..

💬 TrulyAurora, Jul 16th 2024 at 5:08 AM

Is there a way to allow for modded beds to set spawn? We are using Vies Blocks in our server and they add storage beds that function as both storage, and beds (hence the name) with a couple other functions. There is a large amount of the beds so would something in the config be able to be modified or a whitelist that will force a bed to allow spawn being set?

💬 ilan , Jun 16th 2024 at 3:32 PM

Thanks for the kind words :) And I'm glad that 1.2.0 works!

💬 CKitt, Jun 16th 2024 at 1:17 PM

I'll give it a try today! For what it's worth, 1.0.0 was working great during half a dozen hours of multiplayer.

Edit: After the usual tests, no issues at all, zero errors. I think 1.2.0 is the ticket!

💬 ilan , Jun 15th 2024 at 9:13 PM

Oh, sorry about that. I thought I could mark the mod as server-only but it seems that makes the localizations not load in the client (and an oversight in the code made it throw an NPE..)

1.2.0 published with the fixes 😅

💬 CKitt, Jun 15th 2024 at 8:19 PM

Interesting, after adding the hay bed (and thank you for not making it where I had to add head/foot N/E/W/S individually) and laying in a hay bed, I get the following message:

bedspawn:msgSpawnSet

Subsequently destroying the hay bed crashes the game.

 

Edit: In fact, all beds now have that behavior, even while leaving the blacklist blank. I hope my suggestion didn't just ruin your mod, as v1.0.0 worked perfectly!

Edit 2: The relevant portion of the error log follows.

System.NullReferenceException: Object reference not set to an instance of an object.
at BedSpawn.Patches.BedRemovedPatch.Postfix(BlockBed __instance, IWorldAccessor world, BlockPos pos) in D:\Code\VintageStory\VSMods\src\BedSpawn\BedSpawn\Patches\BedRemovedPatch.cs:line 21

💬 ilan , Jun 15th 2024 at 3:12 PM

😁

💬 CKitt, Jun 15th 2024 at 3:11 PM

Awesome, that was very speedy. Thank you!

💬 ilan , Jun 15th 2024 at 3:05 PM

Glad to help :) I just added the feature you suggested, gonna update the docs now

💬 CKitt, Jun 15th 2024 at 2:58 PM

Excellent, thanks for clarifying and for offering up the source. I always like taking a peek at what mods are actually doing!

💬 ilan , Jun 15th 2024 at 2:47 PM

You can check out the source code in the GitHub repo here: https://github.com/Ilan321/VSMods/tree/master/src/BedSpawn

This mod works with any bed that extends `BlockBed`, which is every bed in the vanilla game (that you can sleep in).

Great suggestion, I will add that :) 

💬 CKitt, Jun 15th 2024 at 2:15 PM

I have a perhaps stupid question, as I can't open the .dll to check for myself: does the type of bed matter? Would I be able to use this with hay beds, aged beds, regular beds, and Vanilla Variants beds alike? Thanks!

 

Edit: Question answered via a creative world and the included /set-fatigue command. All bed variants work as intended. Excellent mod, thank you for that! In the future, if possible, it might be worthwhile to include a config file to allow for enabling/disabling specific beds. As an example, with an older bed spawner mod I'd disable hay beds and use those for long-distance exploration.

💬 ilan , Jun 14th 2024 at 6:38 PM

😄

💬 GermanKursk, Jun 14th 2024 at 5:33 PM

Thank god. Exactly what I needed.

 (edit comment delete)