Files
Purpur/patches/server/0250-Add-toggle-for-RNG-manipulation.patch
granny 7f6f667142 Updated Upstream (Pufferfish)
Upstream has released updates that appear to apply and compile correctly

Pufferfish Changes:
pufferfish-gg/Pufferfish@f05b0e9 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@9a82b86 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@c6ec7a0 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@c789f72 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@9ddaa1a Updated Upstream (Paper)
pufferfish-gg/Pufferfish@3554f78 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@a9e9d99 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@09a2f81 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@63ce67d Updated Upstream (Paper)
pufferfish-gg/Pufferfish@8abd47b Updated Upstream (Paper)
pufferfish-gg/Pufferfish@3415da0 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@cfa3c61 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@0a8641d 1.21.3 Update
pufferfish-gg/Pufferfish@784d72f Updated Upstream (Paper)
pufferfish-gg/Pufferfish@40e1ad0 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@95ef348 Make iterator counting in IteratorSafeOrderedReferenceSet thread-safe for async mob spawning (#109)
pufferfish-gg/Pufferfish@34c0042 Updated Upstream (Paper)
2024-11-30 20:49:52 -08:00

51 lines
3.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Tue, 12 Jul 2022 14:16:10 -0400
Subject: [PATCH] Add toggle for RNG manipulation
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 c1ba5eab15bb4b7599c1e5e23b90dfb361af93b6..2b612bfe6da7cc6d6447c60aa6f4b72b2616b72d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -602,7 +602,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.bb = Entity.INITIAL_AABB;
this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F;
- this.random = SHARED_RANDOM; // Paper - Share random for entities to make them more random
+ this.random = world == null || world.purpurConfig.entitySharedRandom ? SHARED_RANDOM : RandomSource.create(); // Paper - Share random for entities to make them more random // Purpur
this.remainingFireTicks = -this.getFireImmuneTicks();
this.fluidHeight = new Object2DoubleArrayMap(2);
this.fluidOnEyes = new HashSet();
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
index 7cfd9e4e29b8f3cf277679f785bae3cb12d2bd20..36a56553702fa6e4a2ac92b3639c210c94faee73 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
@@ -46,7 +46,7 @@ public class Squid extends AgeableWaterCreature {
public Squid(EntityType<? extends Squid> type, Level world) {
super(type, world);
- //this.random.setSeed((long)this.getId()); // Paper - Share random for entities to make them more random
+ if (!world.purpurConfig.entitySharedRandom) this.random.setSeed((long)this.getId()); // Paper - Share random for entities to make them more random // Purpur
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index e13d1e6d15cdfc58f4655ff288d9393e4c134a51..47b29febec2af1f3a8ef7b9afc6a4982df08eb47 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -211,9 +211,11 @@ public class PurpurWorldConfig {
public int entityLifeSpan = 0;
public float entityLeftHandedChance = 0.05f;
+ public boolean entitySharedRandom = true;
private void entitySettings() {
entityLifeSpan = getInt("gameplay-mechanics.entity-lifespan", entityLifeSpan);
entityLeftHandedChance = (float) getDouble("gameplay-mechanics.entity-left-handed-chance", entityLeftHandedChance);
+ entitySharedRandom = getBoolean("settings.entity.shared-random", entitySharedRandom);
}
public boolean infinityWorksWithoutArrows = false;