no sleep in tropical dimension
cbaakman opened this issue ยท 4 comments
In tropicraft 6.0.5, using the bed works, but sleeping doesn't result in the time being reset to day.
It seems that setting time in the tropical realm doesn't have any effect, however, setting the overworld time does change time in the tropical realm. So the following works, though it's not a clean solution..
public class TCMiscEvents {
...
@SubscribeEvent
public void tickWorld (WorldTickEvent event)
{
if (event.phase == Phase.END) {
EffectHelper.tick();
}
boolean allAsleep = true;
int nplayers = 0;
for (WorldServer worldServer: MinecraftServer.getServer().worldServers)
{
if (worldServer.playerEntities.size() > 0 && !worldServer.areAllPlayersAsleep())
{
allAsleep = false;
}
nplayers += worldServer.playerEntities.size();
}
if (nplayers > 0 && allAsleep)
{
for (WorldServer worldServer: MinecraftServer.getServer().worldServers)
{
worldServer.setWorldTime(0);
}
}
}
...
}
OK! Good thing the bed doesn't explode in the tropics though ^^
But wouldn't it be doable to reset time if all players in all dimensions are asleep. This way it would still work in single player mode.
There is no sleeping in any dimension that isn't the overworld. If you'll remember in the Aether, if you slept, the bed would explode. This is because of the way world times work. If you change time in one dimension, it changes time in all other dimensions too. Because of this, we chose not to change time at all.