MCPcopy
hub / github.com/walterhiggins/ScriptCraft / getTime

Function getTime

src/main/js/modules/utils/utils.js:463–479  ·  view source on GitHub ↗

### utils.time( world ) function Returns the timeofday (in minecraft ticks) for the given world. This function is necessary because canarymod and bukkit differ in how the timeofday is calculated. See http://minecraft.gamepedia.com/Day-night_cycle#Conversions

(world)

Source from the content-addressed store, hash-verified

461
462***/
463function getTime(world) {
464 world = _world(world);
465
466 if (__plugin.bukkit) {
467 return world.time;
468 }
469 if (__plugin.canary) {
470 // there's a bug in canary where if you call world.setTime() the world.totalTime
471 // becomes huge.
472 if (world.totalTime < world.rawTime) {
473 return world.totalTime;
474 } else {
475 return (world.totalTime % world.rawTime + world.relativeTime) % 24000;
476 }
477 }
478 return 0;
479}
480exports.time = getTime;
481
482/*************************************************************************

Callers 1

getTime24Function · 0.85

Calls 1

_worldFunction · 0.85

Tested by

no test coverage detected