9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-26 10:29:13 +00:00

[ci skip] cleanup

This commit is contained in:
Dreeam
2025-03-27 17:12:32 -04:00
parent c36c34cf85
commit e56ef42b4e
11 changed files with 63 additions and 88 deletions

View File

@@ -27,7 +27,6 @@ public class SparklyPaperParallelWorldTicking extends ConfigModules {
**实验性功能**
启用并行世界处理以提高多核系统的性能.""");
enabled = config.getBoolean(getBasePath() + ".enabled", enabled);
threads = config.getInt(getBasePath() + ".threads", threads);
threads = enabled ? threads : 0;

View File

@@ -19,7 +19,9 @@ public class FastRNG extends ConfigModules {
public static boolean useLegacyForSlimeChunk = false;
public static boolean useDirectImpl = false;
public static boolean worldgenEnabled() {return enabled && enableForWorldgen;} // Helper function
public static boolean worldgenEnabled() {
return enabled && enableForWorldgen;
} // Helper function
@Override
public void onLoaded() {

View File

@@ -3,8 +3,8 @@ package org.dreeam.leaf.util.map;
import it.unimi.dsi.fastutil.longs.*;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
@@ -41,8 +41,8 @@ public final class ConcurrentLongHashSet extends LongOpenHashSet implements Long
/**
* Creates a new concurrent long set with the specified parameters.
*
* @param initialCapacity the initial capacity
* @param loadFactor the load factor
* @param initialCapacity the initial capacity
* @param loadFactor the load factor
* @param concurrencyLevel the concurrency level
*/
public ConcurrentLongHashSet(int initialCapacity, float loadFactor, int concurrencyLevel) {
@@ -465,9 +465,7 @@ public final class ConcurrentLongHashSet extends LongOpenHashSet implements Long
void clear() {
lock.lock();
try {
for (int i = 0; i < used.length; i++) {
used[i] = false;
}
Arrays.fill(used, false);
size = 0;
} finally {
lock.unlock();

View File

@@ -11,7 +11,6 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.random.RandomGenerator;
import java.util.random.RandomGeneratorFactory;
public class FasterRandomSource implements BitRandomSource {
private static final int INT_BITS = 48;
@@ -42,6 +41,7 @@ public class FasterRandomSource implements BitRandomSource {
if (isSplittableGenerator) {
return new FasterRandomSource(seed, ((RandomGenerator.SplittableGenerator) this.randomGenerator).split());
}
return new FasterRandomSource(this.nextLong());
}
@@ -61,10 +61,9 @@ public class FasterRandomSource implements BitRandomSource {
if (useDirectImpl) {
// Direct
return (int) ((seed = seed * MULTIPLIER + INCREMENT & SEED_MASK) >>> (INT_BITS - bits));
} else {
// old
return (int) ((seed * MULTIPLIER + INCREMENT & SEED_MASK) >>> (INT_BITS - bits));
}
return (int) ((seed * MULTIPLIER + INCREMENT & SEED_MASK) >>> (INT_BITS - bits));
}
public static class FasterRandomSourcePositionalRandomFactory implements PositionalRandomFactory {
@@ -104,9 +103,9 @@ public class FasterRandomSource implements BitRandomSource {
if (useDirectImpl) {
return (int) (((seed = seed * MULTIPLIER + INCREMENT & SEED_MASK) >>> 16) ^
((seed = seed * MULTIPLIER + INCREMENT & SEED_MASK) >>> 32));
} else {
return randomGenerator.nextInt();
}
return randomGenerator.nextInt();
}
@Override
@@ -121,45 +120,45 @@ public class FasterRandomSource implements BitRandomSource {
val = bits % bound;
} while (bits - val + (bound - 1) < 0);
return val;
} else {
return randomGenerator.nextInt(bound);
}
return randomGenerator.nextInt(bound);
}
@Override
public final long nextLong() {
if (useDirectImpl) {
return ((long) next(32) << 32) + next(32);
} else {
return randomGenerator.nextLong();
}
return randomGenerator.nextLong();
}
@Override
public final boolean nextBoolean() {
if (useDirectImpl) {
return next(1) != 0;
} else {
return randomGenerator.nextBoolean();
}
return randomGenerator.nextBoolean();
}
@Override
public final float nextFloat() {
if (useDirectImpl) {
return next(24) / ((float) (1 << 24));
} else {
return randomGenerator.nextFloat();
}
return randomGenerator.nextFloat();
}
@Override
public final double nextDouble() {
if (useDirectImpl) {
return (((long) next(26) << 27) + next(27)) / (double) (1L << 53);
} else {
return randomGenerator.nextDouble();
}
return randomGenerator.nextDouble();
}
@Override