Traveler's Backpack [Fabric]

Traveler's Backpack [Fabric]

11M Downloads

Player Spawnpoint ambiguity

AechtRob opened this issue ยท 7 comments

commented

TravellersBackpack-1.12.2-1.0.23.23

When you sleep in the sleeping bag, it is ambiguous about whether your spawnpoint is updated or not. I think this needs a config option to choose whether or not to set the player spawnpoint when you sleep in the bag (and also obviously retain the new spawnpoint when the bag is removed).

commented

Can you reopen this please? I've been testing the latest version of the mod in 1.12 and I still don't know what we are supposed to expect.

Does sleeping in a sleeping bag set a spawnpoint?
If it does set a spawnpoint, what does breaking/putting away the sleeping bag do to the spawnpoint?

At the moment it looks like the bag simply never sets a spawnpoint - is that what is intended? It would be far more useful if we could decide whether to set it in config (and that IF it did set that it would not get removed again if the sleeping bag was removed).

Thanks!

commented

If you have enabled sleeping bag spawn point in config, It will save your spawn point until you destroy the sleeping bag <- I think that's fair enough for spawn point, you can't have it without bed. If you have disabled spawn point, it won't save the spawn point and it will retain the same as it was.

commented

Thanks you. I see that the config has the ability to set/not set a spawn point now. The problem is that this mod's concept really requires that you pick up the sleeping bag after you wake up and put it away again and then carry on moving. The idea that you have to leave a sleeping bag out for ever and walk away from it never to find it again doesn't always make sense with the idea of a backpack/sleeping bag idea in general, as you would need to keep to making fresh sleeping bags. Its unrealistic.

It is possible to set a spawnpoint which is not attached to a bed in the game. At the moment to make this work I have built my own supporting mod which will preserve the spawnpoint even if you remove the bag again - I think you need that option in your config too. It is very possible to do this (you code it so that when you wake up from the sleeping bag it sets the spawnpoint - that way the spawnpoint is not "attached" to the bed/bag itself at the point you went to sleep).

Best wishes! (And great mod otherwise!)

commented

Could you show me your supporting mod, I can't figure it out

commented

Hi. The supporting mod I am using implements the attached class procedure - it was thrown together quickly using MCreator. This simply sets a spawn point when a player wakes up (from ANYTHING). I am using this generally for all kinds of sleeping in my pack. In order to adapt this logic specifically to your sleeping bag, you would need to somehow make sure that the player had been in the bag, and not sleeping in something else (or else your mod would apply the rule to sleeping in beds or other modded things too). Perhaps all that means is add in a test to ensure that when the player wakes up they are next to your mod's sleeping bag. Alternatively and more rigorously:

  • When the player successfully sleeps in your sleeping bag set a new player nbt tag that persists if the player logs out and in again.
  • When the player wakes up (from ANYTHING) check if they have that sleeping bag nbt tag and if so, set a spawnpoint for them and then clear the nbt tag from the player if they have it.

I've attached the whole mod, but the procedure you want is the one I have pulled out separately in the second file. This sets a spawnpoint which is not related to the block slept in, but is fixed at the block the player wakes up at.

DreamBreaker v.1.18.zip

ProcedureSleep.zip

commented

Finally, it works, I haven't used nbt thing tho, made it simple to not implement any values to player. Update should be available today.