Refactor: Rename offset parameter and add JavaDoc
- Renamed parameter 'i' to 'distance' in Vector3i, Vector3f, and Vector3d to improve code readability. - Added JavaDoc to offset methods to explain the functionality as requested.
This commit is contained in:
1 parent
21866cc94f
commit
c44e502dab
3 files changed
+27
-6
No files matched your search
@@ -189,8 +189,15 @@ public class Vector3d {
|
||||
return add(face.getModX(), face.getModY(), face.getModZ());
|
||||
}
|
||||
|
||||
public Vector3d offset(BlockFace face, int i) {
|
||||
return i == 0 ? this : add(face.getModX() * i, face.getModY() * i, face.getModZ() * i);
|
||||
/**
|
||||
* Offsets the vector by a specific BlockFace direction and distance.
|
||||
*
|
||||
* @param face The direction in which to offset.
|
||||
* @param distance The distance to offset in that direction.
|
||||
* @return A new Vector3d with the calculated offset.
|
||||
*/
|
||||
public Vector3d offset(BlockFace face, int distance) {
|
||||
return distance == 0 ? this : add(face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance);
|
||||
}
|
||||
|
||||
public Vector3d subtract(double x, double y, double z) {
|
||||
|
||||
@@ -150,8 +150,15 @@ public class Vector3f {
|
||||
return add(face.getModX(), face.getModY(), face.getModZ());
|
||||
}
|
||||
|
||||
public Vector3f offset(BlockFace face, int i) {
|
||||
return i == 0 ? this : add(face.getModX() * i, face.getModY() * i, face.getModZ() * i);
|
||||
/**
|
||||
* Offsets the vector by a specific BlockFace direction and distance.
|
||||
*
|
||||
* @param face The direction in which to offset.
|
||||
* @param distance The distance to offset in that direction.
|
||||
* @return A new Vector3f with the calculated offset.
|
||||
*/
|
||||
public Vector3f offset(BlockFace face, int distance) {
|
||||
return distance == 0 ? this : add(face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance);
|
||||
}
|
||||
|
||||
public Vector3f subtract(float x, float y, float z) {
|
||||
|
||||
@@ -217,8 +217,15 @@ public class Vector3i {
|
||||
return add(face.getModX(), face.getModY(), face.getModZ());
|
||||
}
|
||||
|
||||
public Vector3i offset(BlockFace face, int i) {
|
||||
return i == 0 ? this : add(face.getModX() * i, face.getModY() * i, face.getModZ() * i);
|
||||
/**
|
||||
* Offsets the vector by a specific BlockFace direction and distance.
|
||||
*
|
||||
* @param face The direction in which to offset.
|
||||
* @param distance The distance to offset in that direction.
|
||||
* @return A new Vector3i with the calculated offset.
|
||||
*/
|
||||
public Vector3i offset(BlockFace face, int distance) {
|
||||
return distance == 0 ? this : add(face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance);
|
||||
}
|
||||
|
||||
public Vector3i subtract(int x, int y, int z) {
|
||||
|
||||
Reference in new issue
Block a user