From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Thu, 16 Feb 2023 17:25:01 +0800 Subject: [PATCH] Use vanilla random config diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index f0b113a4da3e5f6f064e5daa50ac9171d4563078..6425a01d622d0b9b377614b95fc9d4b4b404eec0 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -550,7 +550,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 = top.leavesmc.leaves.LeavesConfig.useVanillaRandom ? RandomSource.create() : SHARED_RANDOM; // Paper // Leaves - vanilla plz 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 72eea6e512060fc622ca79ca87437f19a64604cc..f5413946fecaa0d7b9d41dd06f12c460fd08ef57 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 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 (top.leavesmc.leaves.LeavesConfig.useVanillaRandom) this.random.setSeed((long) this.getId()); // Paper - we set the random to shared, do not clobber the seed // Leaves - vanilla plz this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; } diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java index f1c5a63a41c7cf7aa01fbc875a06a0dc43ff81f3..a4a0255e537945f49398bf3bc76183c48ff47bb8 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java @@ -520,6 +520,15 @@ public final class LeavesConfig { } } + public static boolean useVanillaRandom = false; + private static boolean useVanillaRandomLock = false; + private static void useVanillaRandom() { + if (!useVanillaRandomLock) { + useVanillaRandom = getBoolean("settings.modify.use-vanilla-random", useVanillaRandom); + useVanillaRandomLock = true; + } + } + public static final class WorldConfig { public final String worldName;