This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
Hey, I'm making a mod and I need to know how to detect if it's night.
If you could help I would thank you.
Level.getTime() < 8000 i think, time 8000 is night :3
but someone say 14400 are night, idk too
A Day in MCPE has 19200 ticks, but after 19200 it counts farer to make the different moon-phases possible, you can use this function:
function isDay(){ //returns true if it is day and false if it is night
var theTime=Level.getTime();
while(theTime>19200){
theTime=theTime-19200;
}
if(theTime>9600)
return false;
else
return true;
Put this function at the Top of your Mod and you can use it like this:
if(isDay()){
//do something if it is day
}else{
//do something if it is night
Hey, I'm making a mod and I need to know how to detect if it's night.
If you could help I would thank you.
Level.getTime() < 8000
i think, time 8000 is night :3
but someone say 14400 are night, idk too
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumA Day in MCPE has 19200 ticks, but after 19200 it counts farer to make the different moon-phases possible, you can use this function:
function isDay(){ //returns true if it is day and false if it is night
var theTime=Level.getTime();
while(theTime>19200){
theTime=theTime-19200;
}
if(theTime>9600)
return false;
else
return true;
}
Put this function at the Top of your Mod and you can use it like this:
if(isDay()){
//do something if it is day
}else{
//do something if it is night
}