mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
28 lines
1.3 KiB
Diff
28 lines
1.3 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 9c6f5b55b1f1376fa75e216cd366ee47c79fafc4..50dc6530e6191f2a00025d4610e335041bc858a4 100644
|
|
--- a/src/main/java/net/minecraft/util/RandomSource.java
|
|
+++ b/src/main/java/net/minecraft/util/RandomSource.java
|
|
@@ -53,7 +53,14 @@ public interface RandomSource {
|
|
double nextGaussian();
|
|
|
|
default double triangle(double mode, double deviation) {
|
|
- return mode + deviation * (this.nextDouble() - this.nextDouble());
|
|
+ // Leaves start - flattenTriangularDistribution
|
|
+ if (org.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) {
|