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

Paper Changes:
PaperMC/Paper@cc491a3 Finish updating chunk system patch
PaperMC/Paper@619d7c9 Add in some patches
PaperMC/Paper@902691b Apply last patch
PaperMC/Paper@efb4197 Fix final compilation issues
PaperMC/Paper@57a5924 Fix boot errors
PaperMC/Paper@c1def9d Updated Upstream (CraftBukkit/Spigot)
PaperMC/Paper@a0a2e72 fix sculk npe
PaperMC/Paper@318a08c add missing block entity type to CraftBlockStates
PaperMC/Paper@aed9ef0 Update adventure
PaperMC/Paper@9d42879 Fix breaking pots throwing exception
PaperMC/Paper@59060aa fix some failing tests
PaperMC/Paper@e325e37 add missing call to EntityInsideBlockEvent
PaperMC/Paper@8ce5219 Fix inconsistent chunk sending with vanilla
PaperMC/Paper@04509f0 Fix crash relating to "Already sent chunk"
PaperMC/Paper@c9eb393 Updated Upstream (Bukkit)
PaperMC/Paper@21f2d15 Avoid duplicate poi entries from the first section (#9235)
PaperMC/Paper@3621d76 Fix collision between AABB and a dot (#8733)
PaperMC/Paper@ccb194b Move block farther away for Player#setRotation (#8514)
PaperMC/Paper@03c3587 fix not editable sign after openSign
PaperMC/Paper@6d74ad1 Finish tests & bad calls
PaperMC/Paper@e829a9d Fix javadoc
PaperMC/Paper@82c6479 Add back Anti-Xray patch (#9283)
PaperMC/Paper@0d969f0 comment out update logic from build.gradle.kts
PaperMC/Paper@ea9fdc3 Ignore inline definitions of trim material & pattern
PaperMC/Paper@9ada4bd Prevent the rcon thread from attempting connections after shutdown
PaperMC/Paper@c9e125f Fix setListenerRange for calibrated sculk sensors
PaperMC/Paper@9ebf75d fix some more 1.20 tracking issues
PaperMC/Paper@f9fc44f add side to PlayerSignCommandPreprocessEvent
PaperMC/Paper@4e3febb fix missing trigger entity for xp orb from breeding
PaperMC/Paper@4b5f847 Minimise EntityFertilizeEggEvent and add sniffer (#9280)
2023-06-09 05:22:52 -07:00

51 lines
3.0 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 f8caeea9c1ecd3c5dfe0f0a1e8aec342ca21f251..7a955f3848fcea9a72e5b758165f7685e74436c2 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -575,7 +575,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.bb = Entity.INITIAL_AABB;
this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F;
- this.random = SHARED_RANDOM; // Paper
+ 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();
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 beef2f6a42eebeaf5761bac841300f780bfdf4f2..41797940d89fec55cb7de4c63eb3ea5cdb4be967 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 WaterAnimal {
public Squid(EntityType<? extends Squid> type, Level world) {
super(type, world);
- //this.random.setSeed((long) this.getId()); // Paper - we set the random to shared, do not clobber the seed
+ if (!world.purpurConfig.entitySharedRandom) this.random.setSeed((long) this.getId()); // Paper - we set the random to shared, do not clobber the seed // 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 9c0bbaf1573167bc558fedfe5656b225de4ff1a3..2544326898b5dcfe0d15a0ebaf0e3cfbea5572b8 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -206,9 +206,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;