-
Bug
-
Resolution: Incomplete
-
None
-
1.19.0.29 Preview, 1.19.0.28 Beta
-
None
-
Plausible
-
Multiple
Let me explain, when you have a Location variable and wants to transform it in a BlockLocation variable have some issues, look:
const location = new Location(20, 0, 20); let locationToBlock = new BlockLocation(location.x, location.y, location.z) // Then this returns a block location with (20, 0, 20). //Now if the coordinates are negative like const location = new Location(-20, 0, -20); let locationToBlock = new BlockLocation(location.x, location.y, location.z) // Then this returns a strange block location like this (-19, 0, -19).
I hope you understand this ![]()
I created a function to "fix" this:
function getBlockFromLocation(location : Location, dimension : Dimension) : Block
{
if(location.x < 0 && location.z < 0)
{
return dimension.getBlock(new BlockLocation(location.x-1, location.y, location.z-1));
}
else if(location.x < 0)
{
return dimension.getBlock(new BlockLocation(location.x-1, location.y, location.z));
}
else if(location.z < 0)
{
return dimension.getBlock(new BlockLocation(location.x, location.y, location.z-1));
}
else
{
return dimension.getBlock(new BlockLocation(location.x, location.y, location.z));
}
}