mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-06-26 06:14:42 +02:00
Add convenience method to set the AABB.
This commit is contained in:
parent
050760afd2
commit
889d21c1d5
|
@ -31,13 +31,25 @@ public class CollideRayVsAABB implements ICollideRayVsAABB {
|
|||
@Override
|
||||
public ICollideRayVsAABB setAABB(double targetX, double targetY, double targetZ,
|
||||
double boxMarginHorizontal, double boxMarginVertical) {
|
||||
// Set from parameters.
|
||||
this.minX = targetX - boxMarginHorizontal;
|
||||
this.minY = targetY;
|
||||
this.minZ = targetZ - boxMarginHorizontal;
|
||||
this.maxX = targetX + boxMarginHorizontal;
|
||||
this.maxY = targetY + boxMarginVertical;
|
||||
this.maxZ = targetZ + boxMarginHorizontal;
|
||||
return this.setAABB(targetX - boxMarginHorizontal, targetY, targetZ - boxMarginHorizontal,
|
||||
targetX + boxMarginHorizontal, targetY + boxMarginVertical, targetZ + boxMarginHorizontal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICollideRayVsAABB setAABB(int targetX, int targetY, int targetZ, double margin) {
|
||||
return setAABB(-margin + targetX, -margin + targetY, -margin + targetZ,
|
||||
1.0 + margin + targetX, 1.0 + margin + targetY, 1.0 + margin + targetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICollideRayVsAABB setAABB(double minX, double minY, double minZ,
|
||||
double maxX, double maxY, double maxZ) {
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.minZ = minZ;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
this.maxZ = maxZ;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ public interface ICollideRayVsAABB extends IGetPosition {
|
|||
double dirX, double dirY, double dirZ);
|
||||
|
||||
/**
|
||||
* Set the properties of the AABB. This can be called independently of
|
||||
* setRay and loop, in order to reiterate with a different AABB to check
|
||||
* against.
|
||||
* Set the properties of the AABB, using foot-center positions and margins.
|
||||
* This can be called independently of setRay and loop, in order to
|
||||
* reiterate with a different AABB to check against.
|
||||
*
|
||||
* @param targetX
|
||||
* Bottom center coordinates of the AABB, e.g. the foot location
|
||||
|
@ -51,11 +51,45 @@ public interface ICollideRayVsAABB extends IGetPosition {
|
|||
* @param targetY
|
||||
* @param targetZ
|
||||
* @param boxMarginHorizontal
|
||||
* @param boxMArginVertical
|
||||
* Margin from the center to the x/z-sides.
|
||||
* @param boxMarginVertical
|
||||
* Margin from targetY to the top of the box.
|
||||
* @return The same instance for chaining.
|
||||
*/
|
||||
public ICollideRayVsAABB setAABB(double targetX, double targetY, double targetZ,
|
||||
double boxMarginHorizontal, double boxMArginVertical);
|
||||
double boxMarginHorizontal, double boxMarginVertical);
|
||||
|
||||
/**
|
||||
* Set the properties of the AABB, using block coordinates and a margin.
|
||||
* This can be called independently of setRay and loop, in order to
|
||||
* reiterate with a different AABB to check against.
|
||||
*
|
||||
* @param targetX
|
||||
* The block coordinates. This is the minimum coordinates, from
|
||||
* which on 1.0 will be added for the maximum coordinates.
|
||||
* @param targetY
|
||||
* @param targetZ
|
||||
* @param margin
|
||||
* A margin to apply towards all directions.
|
||||
* @return The same instance for chaining.
|
||||
*/
|
||||
public ICollideRayVsAABB setAABB(int targetX, int targetY, int targetZ, double margin);
|
||||
|
||||
/**
|
||||
* Set the properties of the AABB directly. This can be called independently
|
||||
* of setRay and loop, in order to reiterate with a different AABB to check
|
||||
* against.
|
||||
*
|
||||
* @param minX
|
||||
* @param minY
|
||||
* @param minZ
|
||||
* @param maxX
|
||||
* @param maxY
|
||||
* @param maxZ
|
||||
* @return The same instance for chaining.
|
||||
*/
|
||||
public ICollideRayVsAABB setAABB(double minX, double minY, double minZ,
|
||||
double maxX, double maxY, double maxZ);
|
||||
|
||||
/**
|
||||
* Set if the nearest point is to be estimated instead, in case the ray does
|
||||
|
|
Loading…
Reference in New Issue
Block a user