9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-25 01:49:16 +00:00

add config

This commit is contained in:
hayanesuru
2025-06-03 20:31:17 +09:00
parent 27fb282b43
commit 8e48e51e76
6 changed files with 119 additions and 47 deletions

View File

@@ -0,0 +1,17 @@
package org.dreeam.leaf.config.modules.opt;
import org.dreeam.leaf.config.ConfigModules;
import org.dreeam.leaf.config.EnumConfigCategory;
public class OptimizeBiome extends ConfigModules {
public String getBasePath() {
return EnumConfigCategory.PERF.getBaseKeyName() + ".cache-mob-spawning-biome";
}
public static boolean enabled = false;
@Override
public void onLoaded() {
enabled = config().getBoolean(getBasePath(), enabled);
}
}

View File

@@ -0,0 +1,28 @@
package org.dreeam.leaf.config.modules.opt;
import net.minecraft.world.entity.MobCategory;
import org.dreeam.leaf.config.ConfigModules;
import org.dreeam.leaf.config.EnumConfigCategory;
public class ThrottleNaturalSpawnMob extends ConfigModules {
public String getBasePath() {
return EnumConfigCategory.PERF.getBaseKeyName() + ".throttled-mob-spawning";
}
public static boolean enabled = false;
public static long[] failedAttempts;
public static int[] spawnChance;
@Override
public void onLoaded() {
enabled = config.getBoolean(getBasePath() + ".enabled", enabled);
MobCategory[] categories = MobCategory.values();
failedAttempts = new long[categories.length];
spawnChance = new int[categories.length];
for (int i = 0; i < categories.length; i++) {
String category = getBasePath() + "." + categories[i].getSerializedName();
failedAttempts[i] = config.getLong(category + ".failed-attempts", -1);
spawnChance[i] = (int) Math.round(config.getDouble(category + ".spawn-chance", 100.0) * 10.24);
}
}
}