Remove Platform Random and use Random from Level instead
shartte opened this issue ยท 1 comments
Platform's current random impl can also, in rare cases, use cause a crash to occur if it is accessed on multiple threads at the same time: https://mclo.gs/081ck73
until the merge is applied, if anyone else is encountering Accessing LegacyRandomSource from multiple threads
, the following will fix it:
diff --git a/src/main/java/appeng/util/Platform.java b/src/main/java/appeng/util/Platform.java
index 8775fba09..eb7c98a2a 100644
--- a/src/main/java/appeng/util/Platform.java
+++ b/src/main/java/appeng/util/Platform.java
@@ -89,7 +89,7 @@ public class Platform {
/*
* random source, use it for item drop locations...
*/
- private static final RandomSource RANDOM_GENERATOR = RandomSource.create();
+ private static final RandomSource RANDOM_GENERATOR = RandomSource.createNewThreadLocalInstance();
private static final P2PHelper P2P_HELPER = new P2PHelper();