Setting spawn isn't working as expected
AechtRob opened this issue ยท 5 comments
Hello,
MC 1.16.5
Mod: TravelersBackpack-1.16.5-5.4.7
I suspect in all versions of the mod though
Using the config option to set the spawn point does not work as expected. The sleeping bag is coded as an extension of the Bed block class. This means that it obeys the standard minecraft mechanic for spawnpoints. That isn't what is wanted in this situation: the sleeping bag should set the spawn point persistently if the config option is set to do so, or else it should not set it at all, and the presence or absence of the still-rolled-out-sleeping-bag should not be a factor. This is because literally nobody is going to leave their backpack with the sleeping bag rolled out for ever after sleeping in it, and at the moment it means sleeping in the bag ruins progress by destroying spawnpoints and resetting spawns to worldspawn, actually taking a player backwards a long way if they die having been using the bag.
With the config option for spawnpoint set to FALSE (functions as expected - the setspawn event is interrupted and no spawn is set):
- expected behaviour: if you sleep in a bag and then die you return to the previous spawnpoint set by a bed.
- observed behaviour: if you sleep in a bag and then die you return to the previous spawnpoint set by a bed.
With the config option for spawnpoint set to TRUE:
- expected behaviour: if you sleep in a bag, and then die you return to the sleeping bags coordinates even if the sleeping bag is no longer there.
- observed behaviour: if you sleep in a bag and then die, if the bag is still there you respawn at the bag. If the bag is not there, you are returned to worldspawn. (i.e. this works exactly the same as a bed)
I think what is needed is something like this, where x y and z are the sleeping bag coordinates, and this would be invoked if something in the sleeping bag interaction method led to the ActionResultType.SUCCESS possibly?
if (player instanceof ServerPlayerEntity && config-option-is-set-to-true) {
((ServerPlayerEntity) entity).func_242111_a(((ServerPlayerEntity) entity).world.getDimensionKey(), new BlockPos(x, y, z), 0, true, false);
}
Something like that ought to set a persistent spawnpoint so that if the bag is not there any more the player is still returned to where it was when they slept. I am not good with1.16 though :/
https://www.curseforge.com/minecraft/mc-mods/travelers-backpack-fabric/files
available for all latest updates for fabric
Forge soon
BY the way, this is related to my old issue here, about the 1.12 version, in case that helps at all: #100