Fix nullable world in Entity constructor (0282) (#1186)

This commit is contained in:
SkytAsul
2022-11-11 23:23:32 +01:00
committed by GitHub
parent 6e7a51e103
commit f72fd9b28b

View File

@@ -7,7 +7,7 @@ Paper patches RNG maniplulation by using a shared (and locked) random source.
This comes with a performance gain, but technical players may prefer the ability to manipulate RNG.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f9cf68820e01619a4ec319f18583a24115bfe112..cd97d28e85a6795099ec314e9574aa413ff93156 100644
index 2988818acd52ae37f4ac4005ae550aefc40fe431..ef8d7c0c922cdc9e4ee857144677990c90c663ba 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -576,7 +576,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -15,7 +15,7 @@ index f9cf68820e01619a4ec319f18583a24115bfe112..cd97d28e85a6795099ec314e9574aa41
this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F;
- this.random = SHARED_RANDOM; // Paper
+ this.random = world.purpurConfig.entitySharedRandom ? SHARED_RANDOM : RandomSource.create(); // Paper // Purpur
+ this.random = world == null || world.purpurConfig.entitySharedRandom ? SHARED_RANDOM : RandomSource.create(); // Paper // Purpur
this.remainingFireTicks = -this.getFireImmuneTicks();
this.fluidHeight = new Object2DoubleArrayMap(2);
this.fluidOnEyes = new HashSet();