-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #332 from FTBTeam/bugfix/1.21/map-component-screen…
…-fix [1.21] Open minimap component screen from config screen
- Loading branch information
Showing
3 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
common/src/main/java/dev/ftb/mods/ftbchunks/client/minimap/MinimapComponentConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package dev.ftb.mods.ftbchunks.client.minimap; | ||
|
||
import dev.ftb.mods.ftbchunks.client.gui.MinimapInfoSortScreen; | ||
import dev.ftb.mods.ftblibrary.config.ConfigCallback; | ||
import dev.ftb.mods.ftblibrary.config.ConfigGroup; | ||
import dev.ftb.mods.ftblibrary.config.ConfigValue; | ||
import dev.ftb.mods.ftblibrary.snbt.config.SNBTConfig; | ||
import dev.ftb.mods.ftblibrary.snbt.config.StringMapValue; | ||
import dev.ftb.mods.ftblibrary.ui.Widget; | ||
import dev.ftb.mods.ftblibrary.ui.input.MouseButton; | ||
import net.minecraft.network.chat.Component; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Map; | ||
|
||
public class MinimapComponentConfig extends StringMapValue { | ||
|
||
public MinimapComponentConfig(@Nullable SNBTConfig c, String n, Map<String, String> def) { | ||
super(c, n, def); | ||
} | ||
|
||
|
||
@Override | ||
public void createClientConfig(ConfigGroup group) { | ||
group.add(key, new MinimapComponentConfigValue(), get(), stringBooleanMap -> { | ||
}, defaultValue); | ||
} | ||
|
||
public static class MinimapComponentConfigValue extends ConfigValue<Map<String, String>> { | ||
|
||
@Override | ||
public void onClicked(Widget clickedWidget, MouseButton button, ConfigCallback callback) { | ||
new MinimapInfoSortScreen().openGui(); | ||
} | ||
|
||
@Override | ||
public Component getStringForGUI(@Nullable Map<String, String> v) { | ||
if (v == null) { | ||
return super.getStringForGUI(null); | ||
} | ||
return Component.translatable("ftbchunks.gui.sort_minimap_info"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters