This commit is contained in:
walterhiggins 2015-01-17 09:30:53 +00:00
parent e95c9596a2
commit 74a97e0ca0

View file

@ -130,12 +130,13 @@ A JSON object in the above form.
***/ ***/
var _locationToJSON = function( location ) { var _locationToJSON = function( location ) {
var yaw = __plugin.bukkit ? location.yaw : (__plugin.canary ? location.rotation : 0);
return { return {
world: ''+location.world.name, world: ''+location.world.name,
x: location.x, x: location.x,
y: location.y, y: location.y,
z: location.z, z: location.z,
yaw: location.yaw, yaw: yaw,
pitch: location.pitch pitch: location.pitch
}; };
}; };
@ -185,10 +186,10 @@ exports.locationFromJSON = function( json ) {
if (__plugin.canary){ if (__plugin.canary){
world = _world( json.world ); world = _world( json.world );
var cmLocation = Packages.net.canarymod.api.world.position.Location; var cmLocation = Packages.net.canarymod.api.world.position.Location;
return new cmLocation(world, json.x, json.y, json.z, json.pitch, json.yaw); return new cmLocation(world, json.x, json.y, json.z, json.pitch?json.pitch:0, json.yaw?json.yaw:0);
} else { } else {
world = _world( json.world ); world = _world( json.world );
return new bkLocation( world, json.x, json.y , json.z, json.yaw, json.pitch ); return new bkLocation( world, json.x, json.y , json.z, json.yaw?json.yaw:0, json.pitch?json.pitch:0 );
} }
} }
}; };