public final class BetterBlockPos extends net.minecraft.util.math.BlockPos
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
Modifier and Type | Field and Description |
---|---|
static BetterBlockPos |
ORIGIN |
int |
x |
int |
y |
int |
z |
Constructor and Description |
---|
BetterBlockPos(net.minecraft.util.math.BlockPos pos) |
BetterBlockPos(double x,
double y,
double z) |
BetterBlockPos(int x,
int y,
int z) |
Modifier and Type | Method and Description |
---|---|
BetterBlockPos |
down() |
BetterBlockPos |
down(int amt) |
BetterBlockPos |
east() |
BetterBlockPos |
east(int amt) |
boolean |
equals(java.lang.Object o) |
static BetterBlockPos |
from(net.minecraft.util.math.BlockPos pos)
Like constructor but returns null if pos is null, good if you just need to possibly censor coordinates
|
int |
hashCode() |
static long |
longHash(BetterBlockPos pos) |
static long |
longHash(int x,
int y,
int z) |
BetterBlockPos |
north() |
BetterBlockPos |
north(int amt) |
BetterBlockPos |
offset(net.minecraft.util.EnumFacing dir) |
BetterBlockPos |
offset(net.minecraft.util.EnumFacing dir,
int dist) |
BetterBlockPos |
south() |
BetterBlockPos |
south(int amt) |
java.lang.String |
toString() |
BetterBlockPos |
up() |
BetterBlockPos |
up(int amt) |
BetterBlockPos |
west() |
BetterBlockPos |
west(int amt) |
add, add, add, crossProduct, fromLong, getAllInBox, getAllInBox, getAllInBoxMutable, getAllInBoxMutable, rotate, subtract, toImmutable, toLong
public static final BetterBlockPos ORIGIN
public final int x
public final int y
public final int z
public BetterBlockPos(int x, int y, int z)
public BetterBlockPos(double x, double y, double z)
public BetterBlockPos(net.minecraft.util.math.BlockPos pos)
public static BetterBlockPos from(net.minecraft.util.math.BlockPos pos)
pos
- The BlockPos, possibly null, to convertpublic int hashCode()
hashCode
in class net.minecraft.util.math.Vec3i
public static long longHash(BetterBlockPos pos)
public static long longHash(int x, int y, int z)
public boolean equals(java.lang.Object o)
equals
in class net.minecraft.util.math.Vec3i
public BetterBlockPos up()
up
in class net.minecraft.util.math.BlockPos
public BetterBlockPos up(int amt)
up
in class net.minecraft.util.math.BlockPos
public BetterBlockPos down()
down
in class net.minecraft.util.math.BlockPos
public BetterBlockPos down(int amt)
down
in class net.minecraft.util.math.BlockPos
public BetterBlockPos offset(net.minecraft.util.EnumFacing dir)
offset
in class net.minecraft.util.math.BlockPos
public BetterBlockPos offset(net.minecraft.util.EnumFacing dir, int dist)
offset
in class net.minecraft.util.math.BlockPos
public BetterBlockPos north()
north
in class net.minecraft.util.math.BlockPos
public BetterBlockPos north(int amt)
north
in class net.minecraft.util.math.BlockPos
public BetterBlockPos south()
south
in class net.minecraft.util.math.BlockPos
public BetterBlockPos south(int amt)
south
in class net.minecraft.util.math.BlockPos
public BetterBlockPos east()
east
in class net.minecraft.util.math.BlockPos
public BetterBlockPos east(int amt)
east
in class net.minecraft.util.math.BlockPos
public BetterBlockPos west()
west
in class net.minecraft.util.math.BlockPos
public BetterBlockPos west(int amt)
west
in class net.minecraft.util.math.BlockPos
@Nonnull public java.lang.String toString()
toString
in class net.minecraft.util.math.Vec3i