Compilation error fixes

This commit is contained in:
Nassim Jahnke
2022-06-08 15:59:48 +02:00
parent 92f5ec1d15
commit 0da6d1d498
5 changed files with 62 additions and 2 deletions

View File

@@ -26,9 +26,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package io.papermc.paper.util.math;
+
+import net.minecraft.util.RandomSource;
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
+
+import java.util.Random;
+
+public final class ThreadUnsafeRandom extends Random {
+public final class ThreadUnsafeRandom extends Random implements RandomSource {
+
+ // See javadoc and internal comments for java.util.Random where these values come from, how they are used, and the author for them.
+ private static final long multiplier = 0x5DEECE66DL;
@@ -42,6 +45,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private long seed;
+
+ @Override
+ public RandomSource fork() {
+ return new ThreadUnsafeRandom();
+ }
+
+ @Override
+ public PositionalRandomFactory forkPositional() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int nextInt(int origin, int bound) {
+ return RandomSource.super.nextInt(origin, bound);
+ }
+
+ @Override
+ public void setSeed(long seed) {
+ // note: called by Random constructor
+ this.seed = initialScramble(seed);