mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fixed inaccuracy with LocalPlayer.getBlockIn() and LocalPlayer.getBlockOn().
This commit is contained in:
parent
e8d6c0acfe
commit
2f71a32f64
@ -276,7 +276,9 @@ public abstract class LocalPlayer {
|
|||||||
* @return point
|
* @return point
|
||||||
*/
|
*/
|
||||||
public WorldVector getBlockIn() {
|
public WorldVector getBlockIn() {
|
||||||
return getPosition();
|
WorldVector pos = getPosition();
|
||||||
|
return WorldVector.toBlockPoint(pos.getWorld(), pos.getX(),
|
||||||
|
pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -286,7 +288,8 @@ public abstract class LocalPlayer {
|
|||||||
*/
|
*/
|
||||||
public WorldVector getBlockOn() {
|
public WorldVector getBlockOn() {
|
||||||
WorldVector pos = getPosition();
|
WorldVector pos = getPosition();
|
||||||
return new WorldVector(pos.getWorld(), pos.subtract(0, 1, 0));
|
return WorldVector.toBlockPoint(pos.getWorld(), pos.getX(),
|
||||||
|
pos.getY() - 1, pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,6 +93,21 @@ public class WorldVector extends Vector {
|
|||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a block point from a point.
|
||||||
|
*
|
||||||
|
* @param x
|
||||||
|
* @param y
|
||||||
|
* @param z
|
||||||
|
* @return point
|
||||||
|
*/
|
||||||
|
public static WorldVector toBlockPoint(LocalWorld world, double x, double y,
|
||||||
|
double z) {
|
||||||
|
return new WorldVector(world, (int)Math.floor(x),
|
||||||
|
(int)Math.floor(y),
|
||||||
|
(int)Math.floor(z));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a BlockVector version.
|
* Gets a BlockVector version.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user