mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-21 07:49:35 +00:00
44 lines
2.0 KiB
Diff
44 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Wed, 30 Nov 2022 07:32:05 +0800
|
|
Subject: [PATCH] Random flatten triangular distribution
|
|
|
|
This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition)
|
|
|
|
diff --git a/src/main/java/net/minecraft/util/RandomSource.java b/src/main/java/net/minecraft/util/RandomSource.java
|
|
index ff1ad1024419182f7f3de578442c1c033d4c9ebb..d93f3eeea17d58ccc01c6010b2d49f813dc0d85f 100644
|
|
--- a/src/main/java/net/minecraft/util/RandomSource.java
|
|
+++ b/src/main/java/net/minecraft/util/RandomSource.java
|
|
@@ -55,7 +55,14 @@ public interface RandomSource {
|
|
double nextGaussian();
|
|
|
|
default double triangle(double mode, double deviation) {
|
|
- return mode + deviation * (this.nextDouble() - this.nextDouble());
|
|
+ // Leaves start - flattenTriangularDistribution
|
|
+ if (top.leavesmc.leaves.LeavesConfig.flattenTriangularDistribution) {
|
|
+ this.nextDouble();
|
|
+ return mode + deviation * (-1 + this.nextDouble() * 2);
|
|
+ } else {
|
|
+ return mode + deviation * (this.nextDouble() - this.nextDouble());
|
|
+ }
|
|
+ // Leaves end - flattenTriangularDistribution
|
|
}
|
|
|
|
default void consumeCount(int count) {
|
|
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
index a06ea69adcfba10b4f5deb0dfd1798974a862eed..383264142a2b138424fd22a65fb58fb480e721f3 100644
|
|
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
@@ -417,6 +417,11 @@ public final class LeavesConfig {
|
|
}
|
|
}
|
|
|
|
+ public static boolean flattenTriangularDistribution = false;
|
|
+ private static void flattenTriangularDistribution() {
|
|
+ flattenTriangularDistribution = getBoolean("settings.modify.flatten-triangular-distribution", flattenTriangularDistribution);
|
|
+ }
|
|
+
|
|
public static final class WorldConfig {
|
|
|
|
public final String worldName;
|