mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
progress on silk touch spawner patch
This commit is contained in:
50
patches/server/0249-Add-toggle-for-RNG-manipulation.patch
Normal file
50
patches/server/0249-Add-toggle-for-RNG-manipulation.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
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 2d1fc8734f440c284710c71abc6789e8185ec909..68e8f9913055219486ce19d95dcf9d7c76e08082 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -597,7 +597,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 b86676ebcd6c301e5dd857d8e84e1db2c1da416b..cb950ba3ee3bdfe0ff7acdb94c7ee233d73ab22e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -42,7 +42,7 @@ public class Squid extends WaterAnimal {
|
||||
|
||||
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 2e7b471b23694cdce1b8017c14e1f2ca62b90538..da2bde5acf5a2e79ad2885f4727844e85de5ca0d 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -202,9 +202,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;
|
||||
Reference in New Issue
Block a user