Set spawn when you sleep - even if bed is broken

Started by Aecht_Rob on

Topic category: Help with MCreator software

Last seen on 16:59, 6. Aug 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Set spawn when you sleep - even if bed is broken

I am trying to get MCreator to just set a player's spawn when they wake up, and ignore anything to do with the bed. This is because I want to retain the new spawn even if a bed is broken afterwards, and want it to set the spawn if modded things are slept in like sleeping bags etc. I thought I could just insert an MCreator procedure, but this one here has no effect. Can anyone help?

 

MCreator screenbshot

Thanks

 

Rob.

 

 

Last seen on 16:59, 6. Aug 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Just been fiddling with this…
Tue, 02/11/2020 - 17:26

Just been fiddling with this. It seems to work when the trigger is "player goes to bed", but not when "player wakes up"! However, the goes to bed thing is reported to trigger when you right-click on a bed even if it's daytime. I can test if it's nighttime I suppose, though that wont get round the issue when there are monsters nearby preventing sleep. Is this correct?

Is the failure of the "player wakes up" a bug in MCreator?

Last seen on 01:34, 21. May 2020
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I would think so. But if…
Tue, 02/11/2020 - 20:07

I would think so. But if there are monsters nearby it will still set spawn. If you where to create sleeping bags you would have to test for monster around you anyway. So this might be a bit of a stretch but if you had another procedure that gets the entity's position and see's if it is within 10 blocks of the player than send message "monsters near by" but I don't know exactly what triggers would work for that

Last seen on 16:59, 6. Aug 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That's a nightmare (and…
Wed, 02/12/2020 - 09:41

That's a nightmare (and hence a pun!)........ Minecraft Wiki says that hostile mobs "within 8 blocks of the bed horizontally (in the X- and Z-axis), and 5 blocks vertically (in the Y-axis)" will prevent sleep. However, the MCreator mod is detecting the x/y/z of the PLAYER, not the bed/bag, so I don't think this test can be done reliably. Also, in multiplayer mode, you will enter the bed/bag but won't sleep until the other player(s) are also in bed, so the spawnpoint will always set without sleeping in that case. I'll ask MCreator what the deal is with the "player wakes up" thing, as trying to leverage the going to bed trigger isn't going to be very reliable.

Last seen on 16:59, 6. Aug 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
For info..... this is far as…
Wed, 02/12/2020 - 10:06

For info..... this is far as I think I can get using the "goes to bed" trigger:

 

Goes to bed

Last seen on 01:34, 21. May 2020
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is there a block that checks…
Thu, 02/13/2020 - 08:59

Is there a block that checks for the amount of players in the server? because if so you could set that as a variable and then have an "if x = number of players in server than:" statement. Is it possible to create it that you have to be 1 block in any direction away from the bed to set spawn? if so then you could check for enemies nearby and that could work

 

Thanks,

Shadow

Last seen on 16:59, 6. Aug 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hmmm very odd. After my…
Thu, 02/13/2020 - 15:23

Hmmm very odd. After my issue was closed due to tests showing it was not an issue....... starting a new workspace and building this from scratch seems to have worked fine now, using the "player wakes up" trigger!

Last seen on 01:34, 21. May 2020
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh cool! So has this problem…
Thu, 02/13/2020 - 19:51

Oh cool!

So has this problem been solved or do you wish to have more assistance?

 

Thanks,

Shadow

Last seen on 16:59, 6. Aug 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I've rebuilt the original…
Thu, 02/13/2020 - 20:13

I've rebuilt the original full mod now into a new workspace (gah!). But it needs a bit of a test now before  know. Is this common that some kind of compiling goes wrong in MCreator or something? No more help needed at present but I'll reply here if something else seems to go wrong.

Last seen on 01:34, 21. May 2020
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok cool!
Fri, 02/14/2020 - 22:46

Ok cool!

Last seen on 16:59, 6. Aug 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This seems to not work any…
Sat, 04/25/2020 - 19:37

This seems to not work any more again. The setSpawnPoint part of the generated proc just doesn't have any effect:

if (entity instanceof EntityPlayer)
            ((EntityPlayer) entity).setSpawnPoint(new BlockPos((int) (entity.posX), (int) (entity.posY), (int) (entity.posZ)), true);

Last seen on 16:59, 6. Aug 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
And again.... using the…
Sat, 04/25/2020 - 20:09

And again.... using the player sleeps trigger works fine, though the player wakes up one does not work. This is very odd indeed, as it's the same code which runs!