9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-22 16:39:30 +00:00
Files
LeavesMC/patches/server/0060-Use-vanilla-random-config.patch
2023-02-17 11:52:33 +08:00

53 lines
2.8 KiB
Diff

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 78a0b3c00860a8433fe0e4b27e51fdd683793c2e..2174dda53093fb4a5a87d4c20855508d07477ed0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -549,7 +549,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 a51424d29ac353cf1bec4d1484db0acb63bebba5..3172c2f10d5018427022f3bb479038db94f3b4f3 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 (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 03ccb227cbc2077eb34185c41eae976a0885621b..2c44dff0db0b0824e983739510810e10f78910c7 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -513,6 +513,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;