diff --git a/patches/server/ConcurrentUtil.patch b/patches/server/ConcurrentUtil.patch index ad373f03f9..5f96c71aad 100644 --- a/patches/server/ConcurrentUtil.patch +++ b/patches/server/ConcurrentUtil.patch @@ -4123,7 +4123,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import ca.spottedleaf.concurrentutil.util.IntegerUtil; +import ca.spottedleaf.concurrentutil.util.ThrowUtil; +import ca.spottedleaf.concurrentutil.util.Validate; -+ +import java.lang.invoke.VarHandle; +import java.util.Arrays; +import java.util.Iterator; @@ -5573,23 +5572,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.currentTable = null; + return null; + } -+ final TableEntry[] newTable = resizeChain.table; -+ if (newTable == null) { ++ ++ final ResizeChain prevChain = resizeChain.prev; ++ this.resizeChain = prevChain; ++ if (prevChain == null) { + this.currentTable = null; + return null; + } + -+ // the increment is a multiple of table.length, so we can undo the increments on idx by taking the -+ // mod ++ final TableEntry[] newTable = prevChain.table; ++ ++ // we recover the original index by modding by the new table length, as the increments applied to the index ++ // are a multiple of the new table's length + int newIdx = index & (newTable.length - 1); + -+ final ResizeChain newChain = this.resizeChain = resizeChain.prev; -+ final TableEntry[] prevTable = newChain.table; ++ // the increment is always the previous table's length ++ final ResizeChain nextPrevChain = prevChain.prev; + final int increment; -+ if (prevTable == null) { ++ if (nextPrevChain == null) { + increment = 1; + } else { -+ increment = prevTable.length; ++ increment = nextPrevChain.table.length; + } + + // done with the upper table, so we can skip the resize node @@ -5706,8 +5709,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + protected ResizeChain(final TableEntry[] table, final ResizeChain prev, final ResizeChain next) { + this.table = table; -+ this.next = next; + this.prev = prev; ++ this.next = next; + } + } + }