Started by
Aecht_Rob
on
Topic category: Help with MCreator software
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?
Thanks
Rob.
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?
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
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.
For info..... this is far as I think I can get using the "goes to bed" trigger:
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
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!
Oh cool!
So has this problem been solved or do you wish to have more assistance?
Thanks,
Shadow
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.
Ok cool!
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);
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!