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

Paper Changes:
PaperMC/Paper@c1bca9a Add exploded block state to BlockExplodeEvent (#6818)
PaperMC/Paper@94373f0 Fix OfflinePlayer#getPlayerProfile returning deprecated type (#8543)
PaperMC/Paper@7b52db5 Fix buffer-joins-to-world patch
PaperMC/Paper@048ee58 Fix OfflinePlayer getPlayerProfile return type (#8710)
PaperMC/Paper@e05ba98 Avoid to spam the transform event for hoglin->zoglin conversion (#8712)
PaperMC/Paper@8e83c3c Deprecate ProjectileCollideEvent (#8678)
PaperMC/Paper@c59922d Expose signed message in chat events (#8694)
PaperMC/Paper@5717b84 Add config option for spider worldborder climbing (#6448)
PaperMC/Paper@e6f61f7 fix ArmorStandMeta not applying false flags (#8632)
PaperMC/Paper@47abd1c Add EntityPushedByEntityEvent (#7704)
PaperMC/Paper@f26e9cc Tadpole lock API (#8297)
PaperMC/Paper@3331501 Use team display name for quit message (#7127)
PaperMC/Paper@1975fbe Respect SpigotConfig logCommands & fix stopDancing() NPE (#8715)
PaperMC/Paper@78a91df Fix (again) Player#getPlayerProfile no such method error (#8722)
PaperMC/Paper@52718db Updated Upstream (Bukkit/CraftBukkit) (#8714)
PaperMC/Paper@2040c1e Player Flying Fall Damage API (#5357)
2022-12-27 15:55:36 -05: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 85462494d0fc140569745b7a97b1737a747a6fb6..d87ec515d3129662d7e101dd822e08ce4d7adb61 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -577,7 +577,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 21f5304e01e0844f1bbf3e1b2f9d50c01f8bf8fd..8afdb5d4fecbb45bad2ed801fc0e526d15ef07c5 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 d03d3ee880c7907bd7f1223ab104bcdcb3f73d56..62bad1a35bae5fea6878e6734381cbbfe19e5673 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -207,9 +207,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;