Constructor and Description |
---|
BlockRayHit(E extent,
double x,
double y,
double z,
com.flowpowered.math.vector.Vector3d direction,
com.flowpowered.math.vector.Vector3d normal)
Constructs a new block ray hit from the extent that contains it, the
coordinates and the face that was entered.
|
Modifier and Type | Method and Description |
---|---|
com.flowpowered.math.vector.Vector3i |
getBlockPosition()
Returns the position of the block that was hit.
|
int |
getBlockX()
Returns the x coordinate of the block that was hit.
|
int |
getBlockY()
Returns the y coordinate of the block that was hit.
|
int |
getBlockZ()
Returns the z coordinate of the block that was hit.
|
com.flowpowered.math.vector.Vector3d |
getDirection()
Returns the direction of the ray as a normalized vector.
|
E |
getExtent()
Returns the extent that contains the block.
|
Direction[] |
getFaces()
Returns all the intersected faces.
|
Location<E> |
getLocation()
Returns the location of the hit block, not the intersection
location.
|
com.flowpowered.math.vector.Vector3d |
getNormal()
Returns the normal of the entered face, edge or corner.
|
com.flowpowered.math.vector.Vector3d |
getPosition()
Returns the position of the intersection.
|
double |
getX()
Returns the x coordinate of the intersection.
|
double |
getY()
Returns the y coordinate of the intersection.
|
double |
getZ()
Returns the z coordinate of the intersection.
|
<T> T |
map(BiFunction<E,com.flowpowered.math.vector.Vector3d,T> mapper)
Calls the mapper function on the extent and position.
|
<T> T |
mapBlock(BiFunction<E,com.flowpowered.math.vector.Vector3i,T> mapper)
Calls the mapper function on the extent and block position.
|
String |
toString() |
public BlockRayHit(E extent, double x, double y, double z, com.flowpowered.math.vector.Vector3d direction, com.flowpowered.math.vector.Vector3d normal)
extent
- The extent of the blockx
- The x coordinate of the blocky
- The y coordinate of the blockz
- The x coordinate of the blockdirection
- A normal vector of the ray directionnormal
- The normal of the entered face, edge or cornerpublic E getExtent()
public double getX()
public double getY()
public double getZ()
public com.flowpowered.math.vector.Vector3d getPosition()
public int getBlockX()
public int getBlockY()
public int getBlockZ()
public com.flowpowered.math.vector.Vector3i getBlockPosition()
public Location<E> getLocation()
public com.flowpowered.math.vector.Vector3d getDirection()
public com.flowpowered.math.vector.Vector3d getNormal()
public Direction[] getFaces()
public <T> T map(BiFunction<E,com.flowpowered.math.vector.Vector3d,T> mapper)
T
- The return type of the mappermapper
- The mapperpublic <T> T mapBlock(BiFunction<E,com.flowpowered.math.vector.Vector3i,T> mapper)
T
- The return type of the mappermapper
- The mapper