mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-31 21:06:31 +00:00
数字类型语言文件
This commit is contained in:
@@ -153,6 +153,13 @@ warning.config.number.gaussian.missing_min: "<yellow>Issue found in file <arg:0>
|
||||
warning.config.number.gaussian.missing_max: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'max' argument for 'gaussian' number.</yellow>"
|
||||
warning.config.number.binomial.missing_extra: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'extra' argument for 'binomial' number.</yellow>"
|
||||
warning.config.number.binomial.missing_probability: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'probability' argument for 'binomial' number.</yellow>"
|
||||
warning.config.number.log_normal.missing_min: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'min' argument for 'log_normal' number.</yellow>"
|
||||
warning.config.number.log_normal.missing_max: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'max' argument for 'log_normal' number.</yellow>"
|
||||
warning.config.number.skew_normal.missing_min: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'min' argument for 'skew_normal' number.</yellow>"
|
||||
warning.config.number.skew_normal.missing_max: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'max' argument for 'skew_normal' number.</yellow>"
|
||||
warning.config.number.triangle.missing_min: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'min' argument for 'triangle' number.</yellow>"
|
||||
warning.config.number.triangle.missing_max: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'max' argument for 'triangle' number.</yellow>"
|
||||
warning.config.number.exponential.missing_lambda: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'lambda' argument for 'exponential' number.</yellow>"
|
||||
warning.config.condition.all_of.missing_terms: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'terms' argument for 'all_of' condition.</yellow>"
|
||||
warning.config.condition.all_of.invalid_terms_type: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' has a misconfigured 'all_of' condition, 'terms' should be a map list, current type: '<arg:2>'.</yellow>"
|
||||
warning.config.condition.any_of.missing_terms: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'terms' argument for 'any_of' condition.</yellow>"
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.momirealms.craftengine.core.plugin.context.number;
|
||||
import net.momirealms.craftengine.core.plugin.context.Context;
|
||||
import net.momirealms.craftengine.core.util.MiscUtils;
|
||||
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@@ -65,7 +66,7 @@ public record GaussianNumberProvider(double min, double max, double mean, double
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public @NotNull String toString() {
|
||||
return String.format("GaussianNumberProvider{min=%.2f, max=%.2f, mean=%.2f, stdDev=%.2f, maxAttempts=%d}",
|
||||
min, max, mean, stdDev, maxAttempts);
|
||||
}
|
||||
|
||||
@@ -128,11 +128,11 @@ public record LogNormalNumberProvider(
|
||||
public LogNormalNumberProvider create(Map<String, Object> arguments) {
|
||||
double rawMin = ResourceConfigUtils.getAsDouble(
|
||||
ResourceConfigUtils.requireNonNullOrThrow(arguments.get("min"),
|
||||
"warning.config.number.log-normal.missing_min"), "min");
|
||||
"warning.config.number.log_normal.missing_min"), "min");
|
||||
|
||||
double max = ResourceConfigUtils.getAsDouble(
|
||||
ResourceConfigUtils.requireNonNullOrThrow(arguments.get("max"),
|
||||
"warning.config.number.log-normal.missing_max"), "max");
|
||||
"warning.config.number.log_normal.missing_max"), "max");
|
||||
|
||||
// 自动修正 min <= 0 的情况,防止 Log(0) 崩溃
|
||||
// 如果用户配置 min=0,我们将其修正为一个极小的正数
|
||||
|
||||
@@ -171,11 +171,11 @@ public final class SkewNormalNumberProvider implements NumberProvider {
|
||||
public SkewNormalNumberProvider create(Map<String, Object> arguments) {
|
||||
double min = ResourceConfigUtils.getAsDouble(
|
||||
ResourceConfigUtils.requireNonNullOrThrow(arguments.get("min"),
|
||||
"warning.config.number.skewed.missing_min"), "min");
|
||||
"warning.config.number.skew_normal.missing_min"), "min");
|
||||
|
||||
double max = ResourceConfigUtils.getAsDouble(
|
||||
ResourceConfigUtils.requireNonNullOrThrow(arguments.get("max"),
|
||||
"warning.config.number.skewed.missing_max"), "max");
|
||||
"warning.config.number.skew_normal.missing_max"), "max");
|
||||
|
||||
double defaultMean = (min + max) / 2.0;
|
||||
double mean = ResourceConfigUtils.getAsDouble(
|
||||
|
||||
Reference in New Issue
Block a user