From 0697c425ca7793da4b4df9b622165b03eb8247f1 Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Thu, 3 Oct 2024 03:38:58 -0400 Subject: [PATCH] Document SimpleCollisionBox and HexCollisionBox with Javadoc --- .../collisions/datatypes/HexCollisionBox.java | 16 +++++++++---- .../datatypes/SimpleCollisionBox.java | 24 +++++++++++++++++-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/main/java/ac/grim/grimac/utils/collisions/datatypes/HexCollisionBox.java b/src/main/java/ac/grim/grimac/utils/collisions/datatypes/HexCollisionBox.java index c058abc954..cc23caec69 100644 --- a/src/main/java/ac/grim/grimac/utils/collisions/datatypes/HexCollisionBox.java +++ b/src/main/java/ac/grim/grimac/utils/collisions/datatypes/HexCollisionBox.java @@ -2,10 +2,18 @@ public class HexCollisionBox extends SimpleCollisionBox { - // Mojang's block hitbox values are all based on chunks, so they're stored in game as 16 * the actual values we want - // When copying block hitbox values, it may be easier to simple copy the multiplied values and divide them - // HexCollisionBox is a simple extension of SimpleCollisionBox that does this for us. - // If none of your min/max values are > 1 you probably should not be using this class. + /** + * Creates a box defined by two points in 3d space; used to represent hitboxes and collision boxes. + * Mojang's block hitbox values are all based on chunks, so they're stored in game as 16 * the actual size + * When copying block hitbox values, it may be easier to simple copy the multiplied values and use this class + * If your min/max values are < 1 you should probably check out {@link SimpleCollisionBox} + * @param minX 16 * x position of first corner + * @param minY 16 * y position of first corner + * @param minZ 16 * z position of first corner + * @param maxX 16 * x position of second corner + * @param maxY 16 * y position of second corner + * @param maxZ 16 * z position of second corner + */ public HexCollisionBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { this.minX = minX / 16d; this.minY = minY / 16d; diff --git a/src/main/java/ac/grim/grimac/utils/collisions/datatypes/SimpleCollisionBox.java b/src/main/java/ac/grim/grimac/utils/collisions/datatypes/SimpleCollisionBox.java index f23a824a0b..ab62dea842 100644 --- a/src/main/java/ac/grim/grimac/utils/collisions/datatypes/SimpleCollisionBox.java +++ b/src/main/java/ac/grim/grimac/utils/collisions/datatypes/SimpleCollisionBox.java @@ -20,11 +20,21 @@ public class SimpleCollisionBox implements CollisionBox { public double minX, minY, minZ, maxX, maxY, maxZ; private boolean isFullBlock = false; - // If your min/max values are > 1 you should probably check out HexCollisionBox public SimpleCollisionBox() { this(0, 0, 0, 0, 0, 0, false); } + /** + * Creates a box defined by two points in 3d space; used to represent hitboxes and collision boxes. + * If your min/max values are > 1 you should probably check out {@link HexCollisionBox} + * @param minX x position of first corner + * @param minY y position of first corner + * @param minZ z position of first corner + * @param maxX x position of second corner + * @param maxY y position of second corner + * @param maxZ z position of second corner + * @param fullBlock - whether on not the box is a perfect 1x1x1 sized block + */ public SimpleCollisionBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, boolean fullBlock) { this.minX = minX; this.maxX = maxX; @@ -48,7 +58,17 @@ public SimpleCollisionBox(double minX, double minY, double minZ) { this(minX, minY, minZ, minX + 1, minY + 1, minZ + 1, true); } - // Use only if you don't know the fullBlock status, which is rare + /** + * Creates a box defined by two points in 3d space; used to represent hitboxes and collision boxes. + * If your min/max values are > 1 you should probably check out {@link HexCollisionBox} + * Use only if you don't know the fullBlock status, which is rare + * @param minX x position of first corner + * @param minY y position of first corner + * @param minZ z position of first corner + * @param maxX x position of second corner + * @param maxY y position of second corner + * @param maxZ z position of second corner + */ public SimpleCollisionBox(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { this.minX = minX; this.maxX = maxX;