Allow for accurate teleport signs

This commit is contained in:
Daniel Saukel 2020-10-08 16:02:53 +02:00
parent eac37331d0
commit d8791cc5a8

View File

@ -105,9 +105,13 @@ public class TeleportSign extends Button implements LocationSign {
double y = NumberUtil.parseDouble(loc[1]); double y = NumberUtil.parseDouble(loc[1]);
double z = NumberUtil.parseDouble(loc[2]); double z = NumberUtil.parseDouble(loc[2]);
// If round number, add 0.5 to tp to middle of block // If number is even, add +0.5 to teleport to the middle of the block
x = NumberUtil.parseInt(loc[0]) + 0.5; if (!loc[0].contains(".")) {
z = NumberUtil.parseInt(loc[2]) + 0.5; x += 0.5;
}
if (!loc[2].contains(".")) {
z += 0.5;
}
location.setX(x); location.setX(x);
location.setY(y); location.setY(y);