and a couple more

This commit is contained in:
Leijurv 2018-09-24 17:15:22 -07:00
parent ce39183482
commit 34e5811613
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -106,7 +106,7 @@ public final class BetterBlockPos extends BlockPos {
@Override @Override
public BetterBlockPos down(int amt) { public BetterBlockPos down(int amt) {
// see comment in up() // see comment in up()
return new BetterBlockPos(x, y - amt, z); return amt == 0 ? this : new BetterBlockPos(x, y - amt, z);
} }
@Override @Override
@ -117,6 +117,9 @@ public final class BetterBlockPos extends BlockPos {
@Override @Override
public BetterBlockPos offset(EnumFacing dir, int dist) { public BetterBlockPos offset(EnumFacing dir, int dist) {
if (dist == 0) {
return this;
}
Vec3i vec = dir.getDirectionVec(); Vec3i vec = dir.getDirectionVec();
return new BetterBlockPos(x + vec.getX() * dist, y + vec.getY() * dist, z + vec.getZ() * dist); return new BetterBlockPos(x + vec.getX() * dist, y + vec.getY() * dist, z + vec.getZ() * dist);
} }