--- a/net/minecraft/util/SimpleBitStorage.java
+++ b/net/minecraft/util/SimpleBitStorage.java
@@ -11,8 +11,8 @@
     private final long mask;
     private final int size;
     private final int valuesPerLong;
-    private final int divideMul;
-    private final int divideAdd;
+    private final int divideMul; private final long divideMulUnsigned; // Paper - referenced in b(int) with 2 Integer.toUnsignedLong calls
+    private final int divideAdd; private final long divideAddUnsigned; // Paper
     private final int divideShift;
 
     public SimpleBitStorage(int elementBits, int size, int[] data) {
@@ -56,8 +56,8 @@
         this.mask = (1L << elementBits) - 1L;
         this.valuesPerLong = (char)(64 / elementBits);
         int i = 3 * (this.valuesPerLong - 1);
-        this.divideMul = MAGIC[i + 0];
-        this.divideAdd = MAGIC[i + 1];
+        this.divideMul = MAGIC[i + 0]; this.divideMulUnsigned = Integer.toUnsignedLong(this.divideMul); // Paper
+        this.divideAdd = MAGIC[i + 1]; this.divideAddUnsigned = Integer.toUnsignedLong(this.divideAdd); // Paper
         this.divideShift = MAGIC[i + 2];
         int j = (size + this.valuesPerLong - 1) / this.valuesPerLong;
         if (data != null) {
@@ -73,15 +73,15 @@
     }
 
     private int cellIndex(int index) {
-        long l = Integer.toUnsignedLong(this.divideMul);
-        long m = Integer.toUnsignedLong(this.divideAdd);
-        return (int)((long)index * l + m >> 32 >> this.divideShift);
+        //long l = Integer.toUnsignedLong(this.divideMul); // Paper
+        //long m = Integer.toUnsignedLong(this.divideAdd); // Paper
+        return (int) ((long) index * this.divideMulUnsigned + this.divideAddUnsigned >> 32 >> this.divideShift); // Paper
     }
 
     @Override
-    public int getAndSet(int index, int value) {
-        Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
-        Validate.inclusiveBetween(0L, this.mask, (long)value);
+    public final int getAndSet(int index, int value) { // Paper - make final for inline
+        //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper
+        //Validate.inclusiveBetween(0L, this.mask, (long)value); // Paper
         int i = this.cellIndex(index);
         long l = this.data[i];
         int j = (index - i * this.valuesPerLong) * this.bits;
@@ -91,9 +91,9 @@
     }
 
     @Override
-    public void set(int index, int value) {
-        Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
-        Validate.inclusiveBetween(0L, this.mask, (long)value);
+    public final void set(int index, int value) { // Paper - make final for inline
+        //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper
+        //Validate.inclusiveBetween(0L, this.mask, (long)value); // Paper
         int i = this.cellIndex(index);
         long l = this.data[i];
         int j = (index - i * this.valuesPerLong) * this.bits;
@@ -101,8 +101,8 @@
     }
 
     @Override
-    public int get(int index) {
-        Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
+    public final int get(int index) { // Paper - make final for inline
+        //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
         int i = this.cellIndex(index);
         long l = this.data[i];
         int j = (index - i * this.valuesPerLong) * this.bits;
@@ -124,6 +124,28 @@
         return this.bits;
     }
 
+    // Paper start
+    @Override
+    public final void forEach(DataBitConsumer consumer) {
+        int i = 0;
+        long[] along = this.data;
+        int j = along.length;
+
+        for (int k = 0; k < j; ++k) {
+            long l = along[k];
+
+            for (int i1 = 0; i1 < this.valuesPerLong; ++i1) {
+                consumer.accept(i, (int) (l & this.mask));
+                l >>= this.bits;
+                ++i;
+                if (i >= this.size) {
+                    return;
+                }
+            }
+        }
+    }
+    // Paper end
+
     @Override
     public void getAll(IntConsumer action) {
         int i = 0;
