A lot of GOOD API DOCUMENTATION

This commit is contained in:
Kam committed 2026-03-09 16:20:07 -04:00
1 parent a6c55ca331
commit 319e774518
131 files changed
+3363 -175

No files matched your search

+8
View File
@@ -67,6 +67,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the X coordinate
* @return the X component
*/
public int getX() {
return this.x;
@@ -74,6 +75,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the Y coordinate
* @return the Y component
*/
public int getY() {
return this.y;
@@ -81,6 +83,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the Z coordinate
* @return the Z component
*/
public int getZ() {
return this.z;
@@ -89,6 +92,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the X coordinate as a double
* @return the X component as a double
*/
public double getXD() {
return this.xd;
@@ -96,6 +100,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the Y coordinate as a double
* @return the Y component as a double
*/
public double getYD() {
return this.yd;
@@ -103,6 +108,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the Z coordinate as a double
* @return the Z component as a double
*/
public double getZD() {
return this.zd;
@@ -110,6 +116,8 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Calculate the cross product of this and the given Vector
* @param vec the other vector
* @return the cross product of this vector and the given vector
*/
public Vec3i crossProduct(Vec3i vec) {
return new Vec3i(this.getYD() * vec.getZD() - this.getZD() * vec.getYD(), this.getZD() * vec.getXD() - this.getXD() * vec.getZD(), this.getXD() * vec.getYD() - this.getYD() * vec.getXD());
+70 -4
View File
@@ -50,6 +50,11 @@ public class BlockPos extends Vec3i {
/**
* Add the given coordinates to the coordinates of this BlockPos
*
* @param x X offset
* @param y Y offset
* @param z Z offset
* @return a new BlockPos offset by the given values
*/
public BlockPos add(double x, double y, double z) {
return x == 0.0D && y == 0.0D && z == 0.0D ? this : new BlockPos(this.getXD() + x, this.getYD() + y, this.getZD() + z);
@@ -57,6 +62,11 @@ public class BlockPos extends Vec3i {
/**
* Add the given coordinates to the coordinates of this BlockPos
*
* @param x X offset
* @param y Y offset
* @param z Z offset
* @return a new BlockPos offset by the given values
*/
public BlockPos add(int x, int y, int z) {
return x == 0 && y == 0 && z == 0 ? this : new BlockPos(this.getXD() + x, this.getYD() + y, this.getZD() + z);
@@ -64,6 +74,9 @@ public class BlockPos extends Vec3i {
/**
* Add the given Vector to this BlockPos
*
* @param vec the vector to add
* @return a new BlockPos offset by the vector
*/
public BlockPos add(Vec3i vec) {
return vec.getXD() == 0 && vec.getYD() == 0 && vec.getZD() == 0 ? this : new BlockPos(this.getXD() + vec.getXD(), this.getYD() + vec.getYD(), this.getZD() + vec.getZD());
@@ -71,6 +84,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block up
*
* @return the BlockPos one block above
*/
public BlockPos up() {
return this.up(1);
@@ -78,6 +93,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks up
*
* @param n the distance upward
* @return the BlockPos n blocks above
*/
public BlockPos up(double n) {
return this.offset(EnumFacing.UP, n);
@@ -85,6 +103,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block down
*
* @return the BlockPos one block below
*/
public BlockPos down() {
return this.down(1);
@@ -92,6 +112,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks down
*
* @param n the distance downward
* @return the BlockPos n blocks below
*/
public BlockPos down(double n) {
return this.offset(EnumFacing.DOWN, n);
@@ -99,6 +122,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block in northern direction
*
* @return the BlockPos one block to the north
*/
public BlockPos north() {
return this.north(1);
@@ -106,6 +131,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks in northern direction
*
* @param n the distance northward
* @return the BlockPos n blocks to the north
*/
public BlockPos north(double n) {
return this.offset(EnumFacing.NORTH, n);
@@ -113,6 +141,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block in southern direction
*
* @return the BlockPos one block to the south
*/
public BlockPos south() {
return this.south(1);
@@ -120,6 +150,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks in southern direction
*
* @param n the distance southward
* @return the BlockPos n blocks to the south
*/
public BlockPos south(double n) {
return this.offset(EnumFacing.SOUTH, n);
@@ -127,6 +160,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block in western direction
*
* @return the BlockPos one block to the west
*/
public BlockPos west() {
return this.west(1);
@@ -134,6 +169,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks in western direction
*
* @param n the distance westward
* @return the BlockPos n blocks to the west
*/
public BlockPos west(double n) {
return this.offset(EnumFacing.WEST, n);
@@ -141,6 +179,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block in eastern direction
*
* @return the BlockPos one block to the east
*/
public BlockPos east() {
return this.east(1);
@@ -148,6 +188,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks in eastern direction
*
* @param n the distance eastward
* @return the BlockPos n blocks to the east
*/
public BlockPos east(double n) {
return this.offset(EnumFacing.EAST, n);
@@ -155,6 +198,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block in the given direction
*
* @param facing the direction to offset
* @return the BlockPos one block in the given direction
*/
public BlockPos offset(EnumFacing facing) {
return this.offset(facing, 1);
@@ -162,6 +208,10 @@ public class BlockPos extends Vec3i {
/**
* Offsets this BlockPos n blocks in the given direction
*
* @param facing the direction to offset
* @param n the distance
* @return the BlockPos n blocks in the given direction
*/
public BlockPos offset(EnumFacing facing, double n) {
return n == 0 ? this : new BlockPos(this.getXD() + facing.getFrontOffsetX() * n, this.getYD() + facing.getFrontOffsetY() * n, this.getZD() + facing.getFrontOffsetZ() * n);
@@ -176,6 +226,8 @@ public class BlockPos extends Vec3i {
/**
* Serialize this BlockPos into a long value
*
* @return this position serialized as a long
*/
public long toLong() {
return ((long) this.getX() & X_MASK) << X_SHIFT | ((long) this.getY() & Y_MASK) << Y_SHIFT | ((long) this.getZ() & Z_MASK) << 0;
@@ -183,6 +235,9 @@ public class BlockPos extends Vec3i {
/**
* Create a BlockPos from a serialized long value (created by toLong)
*
* @param serialized the serialized position
* @return a BlockPos decoded from the long
*/
public static BlockPos fromLong(long serialized) {
int i = (int) (serialized << 64 - X_SHIFT - NUM_X_BITS >> 64 - NUM_X_BITS);
@@ -193,6 +248,10 @@ public class BlockPos extends Vec3i {
/**
* Create an Iterable that returns all positions in the box specified by the given corners
*
* @param from the starting corner
* @param to the ending corner
* @return an iterable of all BlockPos within the bounding box
*/
public static Iterable<BlockPos> getAllInBox(BlockPos from, BlockPos to) {
final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ()));
@@ -285,11 +344,16 @@ public class BlockPos extends Vec3i {
/**
* Sets the position, MUST not be name 'set' as that causes obfusication conflicts with func_185343_d
*
* @param x the X coordinate
* @param y the Y coordinate
* @param z the Z coordinate
* @return this mutable position
*/
public BlockPos.MutableBlockPos setPos(int xIn, int yIn, int zIn) {
this.x = xIn;
this.y = yIn;
this.z = zIn;
public BlockPos.MutableBlockPos setPos(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
return this;
}
@@ -318,6 +382,8 @@ public class BlockPos extends Vec3i {
*
* <p>When storing a BlockPos given to you for an extended period of time, make sure you
* use this in case the value is changed internally.</p>
*
* @return an immutable copy of this position
*/
public BlockPos toImmutable() {
return new BlockPos(this);
+23 -12
View File
@@ -32,12 +32,15 @@ public class IntHashMap<V> {
/**
* Returns the object associated to a key
*
* @param key the integer key to look up
* @return the value associated with the key, or null if not found
*/
public V lookup(int p_76041_1_) {
int i = computeHash(p_76041_1_);
public V lookup(int key) {
int i = computeHash(key);
for (IntHashMap.Entry<V> entry = this.slots[getSlotIndex(i, this.slots.length)]; entry != null; entry = entry.nextEntry) {
if (entry.hashEntry == p_76041_1_) {
if (entry.hashEntry == key) {
return entry.valueEntry;
}
}
@@ -47,9 +50,12 @@ public class IntHashMap<V> {
/**
* Returns true if this hash table contains the specified item.
*
* @param key the integer key to check
* @return true if the map contains this key
*/
public boolean containsItem(int p_76037_1_) {
return this.lookupEntry(p_76037_1_) != null;
public boolean containsItem(int key) {
return this.lookupEntry(key) != null;
}
final IntHashMap.Entry<V> lookupEntry(int p_76045_1_) {
@@ -66,19 +72,22 @@ public class IntHashMap<V> {
/**
* Adds a key and associated value to this map
*
* @param key the integer key
* @param value the value to associate with the key
*/
public void addKey(int p_76038_1_, V p_76038_2_) {
int i = computeHash(p_76038_1_);
public void addKey(int key, V value) {
int i = computeHash(key);
int j = getSlotIndex(i, this.slots.length);
for (IntHashMap.Entry<V> entry = this.slots[j]; entry != null; entry = entry.nextEntry) {
if (entry.hashEntry == p_76038_1_) {
entry.valueEntry = p_76038_2_;
if (entry.hashEntry == key) {
entry.valueEntry = value;
return;
}
}
this.insert(i, p_76038_1_, p_76038_2_, j);
this.insert(i, key, value, j);
}
/**
@@ -128,9 +137,11 @@ public class IntHashMap<V> {
/**
* Removes the specified object from the map and returns it
*
* @param key the integer key to remove
*/
public V removeObject(int p_76049_1_) {
IntHashMap.Entry<V> entry = this.removeEntry(p_76049_1_);
public V removeObject(int key) {
IntHashMap.Entry<V> entry = this.removeEntry(key);
return (V) (entry == null ? null : entry.valueEntry);
}