Package baritone.api.utils
Class BetterBlockPos
java.lang.Object
net.minecraft.core.Vec3i
net.minecraft.core.BlockPos
baritone.api.utils.BetterBlockPos
- All Implemented Interfaces:
Comparable<net.minecraft.core.Vec3i>
A better BlockPos that has fewer hash collisions (and slightly more performant offsets)
Is it really faster to subclass BlockPos and calculate a hash in the constructor like this, taking everything into account? Yes. 20% faster actually. It's called BETTER BlockPos for a reason. Source: Benchmark Spreadsheet
- Author:
- leijurv
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.core.BlockPos
net.minecraft.core.BlockPos.MutableBlockPos, net.minecraft.core.BlockPos.TraversalNodeStatus -
Field Summary
FieldsFields inherited from class net.minecraft.core.BlockPos
CODEC, MAX_HORIZONTAL_COORDINATE, PACKED_HORIZONTAL_LENGTH, PACKED_Y_LENGTH, STREAM_CODEC, ZERO -
Constructor Summary
ConstructorsConstructorDescriptionBetterBlockPos(double x, double y, double z) BetterBlockPos(int x, int y, int z) BetterBlockPos(net.minecraft.core.BlockPos pos) -
Method Summary
Modifier and TypeMethodDescriptionabove()above(int amt) below()below(int amt) static BetterBlockPosdeserializeFromLong(long serialized) doubledoubleeast()east(int amt) booleanstatic BetterBlockPosfrom(net.minecraft.core.BlockPos pos) Like constructor but returns null if pos is null, good if you just need to possibly censor coordinatesinthashCode()static longlongHash(int x, int y, int z) static longlongHash(BetterBlockPos pos) north()north(int amt) relative(net.minecraft.core.Direction dir) relative(net.minecraft.core.Direction dir, int dist) static longserializeToLong(int x, int y, int z) south()south(int amt) toString()west()west(int amt) Methods inherited from class net.minecraft.core.BlockPos
asLong, asLong, atY, betweenClosed, betweenClosed, betweenClosed, betweenClosedStream, betweenClosedStream, betweenClosedStream, betweenClosedStream, breadthFirstTraversal, clampLocationWithin, containing, containing, cross, findClosestMatch, getBottomCenter, getCenter, getFlatIndex, getX, getY, getZ, immutable, max, min, multiply, mutable, of, offset, offset, offset, offset, randomBetweenClosed, randomInCube, relative, rotate, spiralAround, squareOutSouthEast, subtract, withinManhattan, withinManhattanStreamMethods inherited from class net.minecraft.core.Vec3i
closerThan, closerToCenterThan, compareTo, distChessboard, distManhattan, distSqr, distToCenterSqr, distToCenterSqr, distToLowCornerSqr, get, getX, getY, getZ, offsetCodec, setX, setY, setZ, toShortString
-
Field Details
-
ORIGIN
-
x
-
y
-
z
-
-
Constructor Details
-
BetterBlockPos
-
BetterBlockPos
-
BetterBlockPos
-
-
Method Details
-
from
Like constructor but returns null if pos is null, good if you just need to possibly censor coordinates- Parameters:
pos- The BlockPos, possibly null, to convert- Returns:
- A BetterBlockPos or null if pos was null
-
hashCode
- Overrides:
hashCodein classnet.minecraft.core.Vec3i
-
longHash
-
longHash
-
equals
- Overrides:
equalsin classnet.minecraft.core.Vec3i
-
above
- Overrides:
abovein classnet.minecraft.core.BlockPos
-
above
- Overrides:
abovein classnet.minecraft.core.BlockPos
-
below
- Overrides:
belowin classnet.minecraft.core.BlockPos
-
below
- Overrides:
belowin classnet.minecraft.core.BlockPos
-
relative
- Overrides:
relativein classnet.minecraft.core.BlockPos
-
relative
- Overrides:
relativein classnet.minecraft.core.BlockPos
-
north
- Overrides:
northin classnet.minecraft.core.BlockPos
-
north
- Overrides:
northin classnet.minecraft.core.BlockPos
-
south
- Overrides:
southin classnet.minecraft.core.BlockPos
-
south
- Overrides:
southin classnet.minecraft.core.BlockPos
-
east
- Overrides:
eastin classnet.minecraft.core.BlockPos
-
east
- Overrides:
eastin classnet.minecraft.core.BlockPos
-
west
- Overrides:
westin classnet.minecraft.core.BlockPos
-
west
- Overrides:
westin classnet.minecraft.core.BlockPos
-
distanceSq
-
distanceTo
-
toString
- Overrides:
toStringin classnet.minecraft.core.Vec3i
-
serializeToLong
-
deserializeFromLong
-