-
Notifications
You must be signed in to change notification settings - Fork 38
/
AtumConfig.java
220 lines (195 loc) · 11.5 KB
/
AtumConfig.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
package com.teammetallurgy.atum.misc;
import com.electronwill.nightconfig.core.file.FileConfig;
import com.google.common.collect.HashMultimap;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.loading.FMLPaths;
import java.io.File;
import java.util.HashMap;
public class AtumConfig {
public static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
public static final General GENERAL = new General(BUILDER);
public static final AtumStart ATUM_START = new AtumStart(BUILDER);
public static final Sandstorm SANDSTORM = new Sandstorm(BUILDER);
public static final WorldGen WORLD_GEN = new WorldGen(BUILDER);
public static final Biome BIOME = new Biome(BUILDER);
public static final Mobs MOBS = new Mobs(BUILDER);
public static class General {
public static final String GENERAL = "general";
public final ForgeConfigSpec.BooleanValue allowCreation;
public final ForgeConfigSpec.BooleanValue fogEnabled;
public General(ForgeConfigSpec.Builder builder) {
builder.push(GENERAL);
this.allowCreation = builder.comment("Can a non-creative user create a portal using the scarab?")
.translation("atum.config.portal_creation")
.define("Atum Portal", true);
this.fogEnabled = builder.comment("Should clientside fog be rendered?")
.translation("atum.config.fog")
.worldRestart()
.define("Atum Fog", true);
builder.pop();
}
}
public static class AtumStart {
public static final String ATUM_START = "atum start";
public ForgeConfigSpec.BooleanValue startInAtum;
public ForgeConfigSpec.ConfigValue<String> atumStartStructure;
public ForgeConfigSpec.BooleanValue startInAtumPortal;
AtumStart(ForgeConfigSpec.Builder builder) {
builder.push(ATUM_START);
this.startInAtum = builder.comment("New players should start in Atum?")
.translation("atum.config.atum_start")
.define("Start in Atum", false);
this.atumStartStructure = builder.comment("Structure that will generate next to the player when starting in Atum (Requires 'Start in Atum' to be enabled). Leave empty for no structure.")
.translation("atum.config.atum_start_structure")
.define("Atum starting structure", "atum:tent_small");
this.startInAtumPortal = builder.comment("Should a portal back to the Overworld generate, when starting in Atum?")
.translation("atum.config.atum_start_portal")
.define("Create Atum Portal", false);
builder.pop();
}
}
public static class Sandstorm {
public static final String SANDSTORM = "sandstorm";
public final ForgeConfigSpec.BooleanValue sandstormEnabled;
public final ForgeConfigSpec.IntValue sandstormSandLayerChance;
public final ForgeConfigSpec.IntValue sandstormFog;
public final ForgeConfigSpec.IntValue sandDarkness;
public final ForgeConfigSpec.IntValue sandAlpha;
public final ForgeConfigSpec.IntValue sandEyesAlpha;
public final ForgeConfigSpec.IntValue sandstormTransitionTime;
Sandstorm(ForgeConfigSpec.Builder builder) {
builder.push(SANDSTORM);
this.sandstormEnabled = builder.comment("Enable/disables all functionality of sandstorms")
.translation("atum.configGui.sandstormenabled")
.define("Sandstorm Enabled", true);
this.sandstormSandLayerChance = builder.comment("Chance for sandstorms to generate sand layers. The higher the value, the more rare it is. Set to 0 to disable.")
.translation("atum.configGui.sandstormsandrarity")
.defineInRange("Sandstorm Sand Layer", 60, 0, 10000);
this.sandstormFog = builder.comment("Multiplier to fog during sandstorms")
.translation("atum.config.sandstormfog")
.defineInRange("Sandstorm Fog", 2, 0, 100);
this.sandDarkness = builder.comment("How light the sand particles are")
.translation("atum.config.sandbrightness")
.defineInRange("Sandstorm Brightness", 75, 0, 100);
this.sandAlpha = builder.comment("Base transparency for sand particles")
.translation("atum.config.sandalpha")
.defineInRange("Sandstorm Base Transparency", 10, 0, 100);
this.sandEyesAlpha = builder.comment("Sand particle transparency while wearing Sandstorm reducing helmets")
.translation("atum.config.sandalpha")
.defineInRange("Sandstorm Helmet Transparency", 40, 0, 100);
this.sandstormTransitionTime = builder.comment("Seconds it takes to transition from clear to sandstorm")
.translation("atum.config.sandstormtransition")
.defineInRange("Sandstorm Transition Time", 25, 0, 100);
builder.pop();
}
}
public static class WorldGen {
public static final String WORLDGEN = "world gen";
public static final String OREGEN = "ore gen";
public final ForgeConfigSpec.DoubleValue mineshaftProbability;
public final ForgeConfigSpec.IntValue ruinsAmount;
public final ForgeConfigSpec.IntValue shrubFrequency;
public final ForgeConfigSpec.IntValue fossilsChance;
public final ForgeConfigSpec.IntValue dungeonChance;
public final ForgeConfigSpec.BooleanValue sandLayerEdge;
WorldGen(ForgeConfigSpec.Builder builder) {
builder.push(WORLDGEN);
this.mineshaftProbability = builder.comment("Probability of mineshafts generating. Set to 0 to disable. Default value same as vanilla overworld")
.translation("atum.config.mineshaft_probability")
.defineInRange("Minecraft probability", 0.007D, 0.0D, 1.0D);
this.ruinsAmount = builder.comment("Specify the amount of ruin variants structures/ruins. Allows for additional ruin structures with a resourcepack")
.translation("atum.config.ruins_amount")
.defineInRange("Ruins Amount", 17, 1, 999);
this.shrubFrequency = builder.defineInRange("Shrub frequency, set to 0 to disable", 1, 0, 64);
this.fossilsChance = builder.defineInRange("Fossils chance, set to 0 to disable", 64, 0, 255);
this.dungeonChance = builder.defineInRange("Dungeon chance, set to 0 to disable", 8, 0, 255);
this.sandLayerEdge = builder.comment("Should Sand Layers generate along all edges?")
.translation("atum.config.sand_layer_enabled")
.define("Enable Sand Layer along edges", true);
builder.pop();
builder.push(OREGEN).comment("All vanilla based ores, uses the vanilla values by default.");
builder.pop();
}
}
public static class Biome {
public static final String BIOME = "biome";
public ForgeConfigSpec.IntValue subBiomeChance;
public ForgeConfigSpec.IntValue oasisChance;
public ForgeConfigSpec.IntValue weight;
Biome(ForgeConfigSpec.Builder builder) {
builder.push(BIOME);
this.subBiomeChance = builder.comment("By default 1 in 30 Sand Plains biomes can contain either an Oasis or Dead Oasis. Set to 0 to disable both oases biomes.")
.translation("atum.config.oaseschances")
.defineInRange("Oases chance", 30, 0, 10000);
this.oasisChance = builder.comment("Sets the percentage chance for oases to generate as an Oasis. The remaining oases will generate as an Dead Oasis. Set to 0 to only get Dead Oasis or to 100 to only get Oasis")
.translation("atum.config.oasispercentage")
.defineInRange("Oasis percentage", 50, 0, 10000);
builder.pop();
}
public Biome(ForgeConfigSpec.Builder builder, String biomeName, int weight) {
builder.push(BIOME);
builder.push(biomeName);
this.weight = builder.defineInRange("weight", weight, -1, 1000);
builder.pop(2);
}
}
public static class Mobs {
public static final String MOBS = "mobs";
public static HashMap<EntityType<?>, MobCategory> ENTITY_CLASSIFICATION = new HashMap<>();
public static HashMultimap<ResourceLocation, EntityType<?>> ENTITY_TYPE = HashMultimap.create();
public ForgeConfigSpec.IntValue min;
public ForgeConfigSpec.IntValue max;
public ForgeConfigSpec.IntValue weight;
public ForgeConfigSpec.IntValue banditPatrolFrequency;
public ForgeConfigSpec.IntValue markedForDeathTimeBaseValue;
public ForgeConfigSpec.BooleanValue displayPharaohSlainMessage;
public Mobs(ForgeConfigSpec.Builder builder) {
builder.push(MOBS);
this.banditPatrolFrequency = builder.comment("How frequent Bandit patrols are. The higher the number, the less patrols will spawn")
.defineInRange("banditPatrolFrequency", 20000, -1, 100000);
this.markedForDeathTimeBaseValue = builder.comment("How long time is required for an Assassin to spawn. The higher the number, the less frequent Assassin will spawn")
.defineInRange("markedForDeathFrequency", 1000, 1, 10000);
this.displayPharaohSlainMessage = builder.comment("Whether a message should be broadcast to everybody, when a Pharaoh have been killed")
.define("displayPharaohSlainMessage", true);
builder.pop();
}
public Mobs(ForgeConfigSpec.Builder builder, String mobName, int min, int max, int weight, EntityType<?> entityType, MobCategory classification, ResourceLocation biomeName) {
ENTITY_CLASSIFICATION.put(entityType, classification);
ENTITY_TYPE.put(biomeName, entityType);
builder.push(MOBS);
builder.push(mobName);
this.min = builder.defineInRange("min", min, -1, 63);
this.max = builder.defineInRange("max", max, 1, 64);
this.weight = builder.defineInRange("weight", weight, -1, 1000);
builder.pop(2);
}
}
public static class ModIntegration {
public static final String MOD_INTEGRATION = "mod integration";
public ModIntegration(ForgeConfigSpec.Builder builder, String modName, boolean defaultValue) {
builder.push(MOD_INTEGRATION);
builder.define(modName, defaultValue);
builder.pop();
}
}
public static ForgeConfigSpec spec = BUILDER.build();
public static class Helper {
private static final FileConfig CONFIG_FILE = FileConfig.of(new File(FMLPaths.CONFIGDIR.get().toFile(), "atum-common.toml"));
public static <T> T get(String category, String subCategory, String value) {
return get(category + "." + subCategory, value);
}
public static <T> T get(String category, String value) {
return get(category + "." + value);
}
public static <T> T get(String category) {
CONFIG_FILE.load();
return CONFIG_FILE.get(category);
}
public static String getSubConfig(String category, String subCategory) {
return category + "." + subCategory;
}
}
}