--- a/net/minecraft/core/BlockPos.java
+++ b/net/minecraft/core/BlockPos.java
@@ -50,15 +50,16 @@
     };
     private static final Logger LOGGER = LogUtils.getLogger();
     public static final BlockPos ZERO = new BlockPos(0, 0, 0);
-    private static final int PACKED_X_LENGTH = 1 + Mth.log2(Mth.smallestEncompassingPowerOfTwo(30000000));
-    private static final int PACKED_Z_LENGTH = PACKED_X_LENGTH;
-    public static final int PACKED_Y_LENGTH = 64 - PACKED_X_LENGTH - PACKED_Z_LENGTH;
-    private static final long PACKED_X_MASK = (1L << PACKED_X_LENGTH) - 1L;
-    private static final long PACKED_Y_MASK = (1L << PACKED_Y_LENGTH) - 1L;
-    private static final long PACKED_Z_MASK = (1L << PACKED_Z_LENGTH) - 1L;
-    private static final int Y_OFFSET = 0;
-    private static final int Z_OFFSET = PACKED_Y_LENGTH;
-    private static final int X_OFFSET = PACKED_Y_LENGTH + PACKED_Z_LENGTH;
+    // Paper start - Optimize Bit Operations by inlining
+    private static final int PACKED_X_LENGTH = 26;
+    private static final int PACKED_Z_LENGTH = 26;
+    public static final int PACKED_Y_LENGTH = 12;
+    private static final long PACKED_X_MASK = 67108863;
+    private static final long PACKED_Y_MASK = 4095;
+    private static final long PACKED_Z_MASK = 67108863;
+    private static final int Z_OFFSET = 12;
+    private static final int X_OFFSET = 38;
+    // Paper end - Optimize Bit Operations by inlining
 
     public BlockPos(int x, int y, int z) {
         super(x, y, z);
@@ -68,28 +69,29 @@
         this(pos.getX(), pos.getY(), pos.getZ());
     }
 
+    public static long getAdjacent(int baseX, int baseY, int baseZ, Direction enumdirection) { return asLong(baseX + enumdirection.getStepX(), baseY + enumdirection.getStepY(), baseZ + enumdirection.getStepZ()); } // Paper
     public static long offset(long value, Direction direction) {
         return offset(value, direction.getStepX(), direction.getStepY(), direction.getStepZ());
     }
 
     public static long offset(long value, int x, int y, int z) {
-        return asLong(getX(value) + x, getY(value) + y, getZ(value) + z);
+        return asLong((int) (value >> 38) + x, (int) ((value << 52) >> 52) + y, (int) ((value << 26) >> 38) + z); // Paper - simplify/inline
     }
 
     public static int getX(long packedPos) {
-        return (int)(packedPos << 64 - X_OFFSET - PACKED_X_LENGTH >> 64 - PACKED_X_LENGTH);
+        return (int) (packedPos >> 38); // Paper - simplify/inline
     }
 
     public static int getY(long packedPos) {
-        return (int)(packedPos << 64 - PACKED_Y_LENGTH >> 64 - PACKED_Y_LENGTH);
+        return (int) ((packedPos << 52) >> 52); // Paper - simplify/inline
     }
 
     public static int getZ(long packedPos) {
-        return (int)(packedPos << 64 - Z_OFFSET - PACKED_Z_LENGTH >> 64 - PACKED_Z_LENGTH);
+        return (int) ((packedPos << 26) >> 38);  // Paper - simplify/inline
     }
 
     public static BlockPos of(long packedPos) {
-        return new BlockPos(getX(packedPos), getY(packedPos), getZ(packedPos));
+        return new BlockPos((int) (packedPos >> 38), (int) ((packedPos << 52) >> 52), (int) ((packedPos << 26) >> 38)); // Paper - simplify/inline
     }
 
     public static BlockPos containing(double x, double y, double z) {
@@ -113,10 +115,7 @@
     }
 
     public static long asLong(int x, int y, int z) {
-        long l = 0L;
-        l |= ((long)x & PACKED_X_MASK) << X_OFFSET;
-        l |= ((long)y & PACKED_Y_MASK) << 0;
-        return l | ((long)z & PACKED_Z_MASK) << Z_OFFSET;
+        return (((long) x & (long) 67108863) << 38) | (((long) y & (long) 4095)) | (((long) z & (long) 67108863) << 12); // Paper - inline constants and simplify
     }
 
     public static long getFlatIndex(long y) {
@@ -153,67 +152,84 @@
 
     @Override
     public BlockPos above() {
-        return this.relative(Direction.UP);
+        return new BlockPos(this.getX(), this.getY() + 1, this.getZ()); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos above(int distance) {
-        return this.relative(Direction.UP, distance);
+        return distance == 0 ? this : new BlockPos(this.getX(), this.getY() + distance, this.getZ()); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos below() {
-        return this.relative(Direction.DOWN);
+        return new BlockPos(this.getX(), this.getY() - 1, this.getZ()); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos below(int i) {
-        return this.relative(Direction.DOWN, i);
+        return i == 0 ? this : new BlockPos(this.getX(), this.getY() - i, this.getZ()); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos north() {
-        return this.relative(Direction.NORTH);
+        return new BlockPos(this.getX(), this.getY(), this.getZ() - 1); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos north(int distance) {
-        return this.relative(Direction.NORTH, distance);
+        return distance == 0 ? this : new BlockPos(this.getX(), this.getY(), this.getZ() - distance); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos south() {
-        return this.relative(Direction.SOUTH);
+        return new BlockPos(this.getX(), this.getY(), this.getZ() + 1); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos south(int distance) {
-        return this.relative(Direction.SOUTH, distance);
+        return distance == 0 ? this : new BlockPos(this.getX(), this.getY(), this.getZ() + distance); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos west() {
-        return this.relative(Direction.WEST);
+        return new BlockPos(this.getX() - 1, this.getY(), this.getZ()); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos west(int distance) {
-        return this.relative(Direction.WEST, distance);
+        return distance == 0 ? this : new BlockPos(this.getX() - distance, this.getY(), this.getZ()); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos east() {
-        return this.relative(Direction.EAST);
+        return new BlockPos(this.getX() + 1, this.getY(), this.getZ()); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos east(int distance) {
-        return this.relative(Direction.EAST, distance);
+        return distance == 0 ? this : new BlockPos(this.getX() + distance, this.getY(), this.getZ()); // Paper - Perf: Optimize BlockPosition
     }
 
     @Override
     public BlockPos relative(Direction direction) {
+        // Paper start - Perf: Optimize BlockPosition
+        switch(direction) {
+            case UP:
+                return new BlockPos(this.getX(), this.getY() + 1, this.getZ());
+            case DOWN:
+                return new BlockPos(this.getX(), this.getY() - 1, this.getZ());
+            case NORTH:
+                return new BlockPos(this.getX(), this.getY(), this.getZ() - 1);
+            case SOUTH:
+                return new BlockPos(this.getX(), this.getY(), this.getZ() + 1);
+            case WEST:
+                return new BlockPos(this.getX() - 1, this.getY(), this.getZ());
+            case EAST:
+                return new BlockPos(this.getX() + 1, this.getY(), this.getZ());
+            default:
         return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ());
+        }
+        // Paper end - Perf: Optimize BlockPosition
     }
 
     @Override
@@ -311,9 +327,11 @@
 
     public static Iterable<BlockPos> withinManhattan(BlockPos center, int rangeX, int rangeY, int rangeZ) {
         int i = rangeX + rangeY + rangeZ;
-        int j = center.getX();
-        int k = center.getY();
-        int l = center.getZ();
+        // Paper start - rename variables to fix conflict with anonymous class (remap fix)
+        int centerX = center.getX();
+        int centerY = center.getY();
+        int centerZ = center.getZ();
+        // Paper end
         return () -> new AbstractIterator<BlockPos>() {
                 private final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
                 private int currentDepth;
@@ -327,7 +345,7 @@
                 protected BlockPos computeNext() {
                     if (this.zMirror) {
                         this.zMirror = false;
-                        this.cursor.setZ(l - (this.cursor.getZ() - l));
+                        this.cursor.setZ(centerZ - (this.cursor.getZ() - centerZ)); // Paper - remap fix
                         return this.cursor;
                     } else {
                         BlockPos blockPos;
@@ -353,7 +371,7 @@
                             int k = this.currentDepth - Math.abs(i) - Math.abs(j);
                             if (k <= rangeZ) {
                                 this.zMirror = k != 0;
-                                blockPos = this.cursor.set(j + i, k + j, l + k);
+                                blockPos = this.cursor.set(centerX + i, centerY + j, centerZ + k); // Paper - remap fix
                             }
                         }
 
@@ -425,12 +443,12 @@
                     if (this.index == l) {
                         return this.endOfData();
                     } else {
-                        int i = this.index % i;
-                        int j = this.index / i;
-                        int k = j % j;
-                        int l = j / j;
+                        int offsetX = this.index % i; // Paper - decomp fix
+                        int u = this.index / i; // Paper - decomp fix
+                        int offsetY = u % j; // Paper - decomp fix
+                        int offsetZ = u / j; // Paper - decomp fix
                         this.index++;
-                        return this.cursor.set(startX + i, startY + k, startZ + l);
+                        return this.cursor.set(startX + offsetX, startY + offsetY, startZ + offsetZ); // Paper - decomp fix
                     }
                 }
             };
@@ -539,9 +557,9 @@
         }
 
         public BlockPos.MutableBlockPos set(int x, int y, int z) {
-            this.setX(x);
-            this.setY(y);
-            this.setZ(z);
+            this.x = x; // Paper - Perf: Manually inline methods in BlockPosition
+            this.y = y; // Paper - Perf: Manually inline methods in BlockPosition
+            this.z = z; // Paper - Perf: Manually inline methods in BlockPosition
             return this;
         }
 
@@ -606,19 +624,19 @@
 
         @Override
         public BlockPos.MutableBlockPos setX(int i) {
-            super.setX(i);
+            this.x = i; // Paper - Perf: Manually inline methods in BlockPosition
             return this;
         }
 
         @Override
         public BlockPos.MutableBlockPos setY(int i) {
-            super.setY(i);
+            this.y = i; // Paper - Perf: Manually inline methods in BlockPosition
             return this;
         }
 
         @Override
         public BlockPos.MutableBlockPos setZ(int i) {
-            super.setZ(i);
+            this.z = i; // Paper - Perf: Manually inline methods in BlockPosition
             return this;
         }
 
