Skip to content

Commit e725ad2

Browse files
committed
Added More SeedMapperHelper Config Items
1 parent 89f73e3 commit e725ad2

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

src/main/java/net/wurstclient/hacks/SeedMapperHelperHack.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ public final class SeedMapperHelperHack extends Hack
224224
private final StringDropdownSetting sourceVersionPresetSetting =
225225
new StringDropdownSetting("Source version presets",
226226
WText.literal("Available /sm:source versioned keys."));
227+
private final StringDropdownSetting worldPresetSetting =
228+
new StringDropdownSetting("World preset",
229+
WText.literal("World generation presets for /sm:preset set."));
230+
private final ButtonSetting listWorldPresetsButton =
231+
new ButtonSetting("List presets",
232+
() -> runSimpleCommand("sm:preset list", "list presets"));
233+
private final ButtonSetting applyWorldPresetButton =
234+
new ButtonSetting("Set selected preset", this::applyWorldPreset);
227235
private final TextFieldSetting sourceVersionSetting =
228236
new TextFieldSetting("Source version override", "");
229237
private final TextFieldSetting sourceSelectorSetting =
@@ -288,6 +296,8 @@ public SeedMapperHelperHack()
288296

289297
sourceDimensionSetting.setOptions(data.getDimensionShortcuts());
290298
sourceVersionPresetSetting.setOptions(data.getVersionShortcuts());
299+
worldPresetSetting.setOptions(data.getWorldPresets());
300+
autoSelectFirst(worldPresetSetting, data.getWorldPresets());
291301

292302
addSetting(statusButton);
293303
addSetting(seedMapButton);
@@ -305,6 +315,9 @@ public SeedMapperHelperHack()
305315
addSetting(applyOreAirCheckButton);
306316
addSetting(clearSeedMapCachesSetting);
307317
addSetting(applyClearSeedMapCachesButton);
318+
addSetting(listWorldPresetsButton);
319+
addSetting(worldPresetSetting);
320+
addSetting(applyWorldPresetButton);
308321
addSetting(seedMapThreadsSetting);
309322
addSetting(applySeedMapThreadsButton);
310323
addSetting(pixelsPerBiomeSetting);
@@ -324,6 +337,7 @@ public SeedMapperHelperHack()
324337
seedResolutionOrderSetting, applySeedResolutionOrderButton,
325338
oreAirCheckSetting, applyOreAirCheckButton,
326339
clearSeedMapCachesSetting, applyClearSeedMapCachesButton,
340+
listWorldPresetsButton, worldPresetSetting, applyWorldPresetButton,
327341
seedMapThreadsSetting, applySeedMapThreadsButton,
328342
pixelsPerBiomeSetting, applyPixelsPerBiomeButton,
329343
toggledFeaturesSetting, applyToggledFeaturesButton, devModeSetting,
@@ -841,6 +855,18 @@ private void applyVersionPreset()
841855
sourceVersionSetting.setValue(preset);
842856
}
843857

858+
private void applyWorldPreset()
859+
{
860+
String preset = worldPresetSetting.getSelected();
861+
if(preset.isEmpty())
862+
{
863+
ChatUtils.error("Pick a world preset first.");
864+
return;
865+
}
866+
runSimpleCommand("sm:preset set " + preset, "set world preset");
867+
worldPresetSetting.setSelected("");
868+
}
869+
844870
private void resetSourceForm()
845871
{
846872
sourceSeedSetting.setValue("");

src/main/java/net/wurstclient/seedmapper/SeedMapperData.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ public final class SeedMapperData
104104
private static final List<String> DEFAULT_DIMENSIONS =
105105
List.of("overworld", "the_nether", "the_end");
106106

107+
private static final List<String> DEFAULT_WORLD_PRESETS = List.of(
108+
"amplified", "superflat", "large_biomes", "single_biome", "default");
109+
107110
private static final List<String> DEFAULT_VERSION_SHORTCUTS = List.of(
108111
"auto", "latest", "1.21.1", "1.21", "1.20.6", "1.20.4", "1.20.2",
109112
"1.20.1", "1.19.4", "1.19.2", "1.18.2", "1.17.1", "1.16.5", "1.12.2");
@@ -124,6 +127,7 @@ public final class SeedMapperData
124127
private final List<String> densityFunctions;
125128
private final List<String> dimensionShortcuts;
126129
private final List<String> versionShortcuts;
130+
private final List<String> worldPresets;
127131

128132
private SeedMapperData(List<String> highlightBlocks,
129133
List<String> canyonCarvers, List<String> caveCarvers,
@@ -132,7 +136,8 @@ private SeedMapperData(List<String> highlightBlocks,
132136
Map<String, List<String>> structureVariants,
133137
List<String> variantKeyUnion, List<String> lootItems,
134138
List<String> lootEnchantments, List<String> densityFunctions,
135-
List<String> dimensionShortcuts, List<String> versionShortcuts)
139+
List<String> dimensionShortcuts, List<String> versionShortcuts,
140+
List<String> worldPresets)
136141
{
137142
this.highlightBlocks = highlightBlocks;
138143
this.canyonCarvers = canyonCarvers;
@@ -147,6 +152,7 @@ private SeedMapperData(List<String> highlightBlocks,
147152
this.densityFunctions = densityFunctions;
148153
this.dimensionShortcuts = dimensionShortcuts;
149154
this.versionShortcuts = versionShortcuts;
155+
this.worldPresets = worldPresets;
150156
}
151157

152158
public List<String> getHighlightBlocks()
@@ -230,6 +236,11 @@ public List<String> getVersionShortcuts()
230236
return versionShortcuts;
231237
}
232238

239+
public List<String> getWorldPresets()
240+
{
241+
return worldPresets;
242+
}
243+
233244
public List<String> getOreVeinTargets()
234245
{
235246
return DEFAULT_ORE_VEINS;
@@ -250,7 +261,8 @@ public static SeedMapperData createFallback()
250261
limitList(items, 1024), limitList(enchants, 256),
251262
copySorted(DEFAULT_DENSITY_FUNCTIONS),
252263
copySorted(DEFAULT_DIMENSIONS),
253-
copySorted(DEFAULT_VERSION_SHORTCUTS));
264+
copySorted(DEFAULT_VERSION_SHORTCUTS),
265+
copySorted(DEFAULT_WORLD_PRESETS));
254266
}
255267

256268
public static SeedMapperData tryLoadFromVendor()
@@ -291,14 +303,18 @@ public static SeedMapperData tryLoadFromVendor()
291303
List<String> versionShortcuts = tryRead(supplyValueList(
292304
"dev.xpple.seedmapper.command.arguments.VersionArgument",
293305
"VERSIONS"), DEFAULT_VERSION_SHORTCUTS);
306+
List<String> worldPresets = tryRead(supplyValueList(
307+
"dev.xpple.seedmapper.command.arguments.PresetArgument", "PRESETS"),
308+
DEFAULT_WORLD_PRESETS);
294309

295310
return new SeedMapperData(copySorted(highlightBlocks),
296311
copySorted(canyonCarvers), copySorted(caveCarvers),
297312
copySorted(biomeKeys), copySorted(structureKeys),
298313
copyMap(structurePieces), copyMap(structureVariants),
299314
buildVariantUnion(structureVariants), limitList(lootItems, 2048),
300315
limitList(lootEnchantments, 512), copySorted(densityFunctions),
301-
copySorted(dimensions), copySorted(versionShortcuts));
316+
copySorted(dimensions), copySorted(versionShortcuts),
317+
copySorted(worldPresets));
302318
}
303319

304320
private static List<String> fallbackBiomes()

0 commit comments

Comments
 (0)