Skip to content

Commit

Permalink
Update ModMenu to 22w15a (#414)
Browse files Browse the repository at this point in the history
- Updated to 1.19 Snapshot 22w15a
- Added a bunch of credits
  • Loading branch information
DenaryDev authored Apr 16, 2022
1 parent 3a713a1 commit 0094a2f
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 24 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@ org.gradle.jvmargs=-Xmx1G
maven_group=com.terraformersmc
archive_name=modmenu

minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
minecraft_version=22w15a
yarn_mappings=22w15a+build.2
loader_version=0.13.3
fabric_version=0.50.0+1.18.2
fabric_version=0.50.1+1.19

# Project Metadata
project_name=Mod Menu
project_url=https://modrinth.com/mod/modmenu
project_logo=https://i.imgur.com/sV3C6uO.png
project_color=0x134bff
# default_release_type can be stable, beta, or alpha
default_release_type=stable
default_release_type=beta

# CurseForge Metadata
curseforge_slug=modmenu
curseforge_id=308702
curseforge_game_versions=1.18.2, Fabric
curseforge_game_versions=1.19-Snapshot, Fabric
curseforge_required_dependencies=
curseforge_optional_dependencies=

# Modrinth Metadata
modrinth_slug=modmenu
modrinth_id=mOgUt4GM
modrinth_game_versions=1.18.2
modrinth_game_versions=22w15a
modrinth_mod_loaders=fabric

# Mod Loader Metadata
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.terraformersmc.modmenu.config.option.OptionConvertable;
import com.terraformersmc.modmenu.config.option.StringSetConfigOption;
import com.terraformersmc.modmenu.util.mod.Mod;
import net.minecraft.client.option.Option;
import net.minecraft.client.option.SimpleOption;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
Expand Down Expand Up @@ -34,8 +34,8 @@ public class ModMenuConfig {
public static final BooleanConfigOption HIDE_CONFIG_BUTTONS = new BooleanConfigOption("hide_config_buttons", false);
public static final StringSetConfigOption HIDDEN_MODS = new StringSetConfigOption("hidden_mods", new HashSet<>());

public static Option[] asOptions() {
ArrayList<Option> options = new ArrayList<>();
public static SimpleOption<?>[] asOptions() {
ArrayList<SimpleOption<?>> options = new ArrayList<>();
for (Field field : ModMenuConfig.class.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && OptionConvertable.class.isAssignableFrom(field.getType()) && !field.getName().equals("HIDE_CONFIG_BUTTONS") && !field.getName().equals("MODIFY_TITLE_SCREEN") && !field.getName().equals("MODIFY_GAME_MENU")) {
try {
Expand All @@ -45,7 +45,7 @@ public static Option[] asOptions() {
}
}
}
return options.stream().toArray(Option[]::new);
return options.stream().toArray(SimpleOption[]::new);
}

public enum Sorting {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.terraformersmc.modmenu.util.TranslationUtil;
import net.minecraft.client.gui.screen.ScreenTexts;
import net.minecraft.client.option.CyclingOption;
import net.minecraft.client.option.SimpleOption;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

Expand Down Expand Up @@ -50,10 +50,12 @@ public Text getButtonText() {
}

@Override
public CyclingOption<Boolean> asOption() {
public SimpleOption<Boolean> asOption() {
if (enabledText != null && disabledText != null) {
return CyclingOption.create(translationKey, enabledText, disabledText, ignored -> ConfigOptionStorage.getBoolean(key), (ignored, option, value) -> ConfigOptionStorage.setBoolean(key, value));
return new SimpleOption<>(translationKey, SimpleOption.emptyTooltip(),
(text, value) -> value ? enabledText : disabledText, SimpleOption.BOOLEAN, defaultValue,
newValue -> ConfigOptionStorage.setBoolean(key, newValue));
}
return CyclingOption.create(translationKey, ignored -> ConfigOptionStorage.getBoolean(key), (ignored, option, value) -> ConfigOptionStorage.setBoolean(key, value));
return SimpleOption.ofBoolean(translationKey, defaultValue, (value) -> ConfigOptionStorage.setBoolean(key, value));
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.terraformersmc.modmenu.config.option;

import com.mojang.serialization.Codec;
import com.terraformersmc.modmenu.util.TranslationUtil;
import net.minecraft.client.gui.screen.ScreenTexts;
import net.minecraft.client.option.CyclingOption;
import net.minecraft.client.option.Option;
import net.minecraft.client.option.SimpleOption;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

import java.util.Arrays;
import java.util.Locale;

public class EnumConfigOption<E extends Enum<E>> implements OptionConvertable {
Expand Down Expand Up @@ -55,7 +56,14 @@ public Text getButtonText() {
}

@Override
public Option asOption() {
return CyclingOption.create(translationKey, enumClass.getEnumConstants(), value -> getValueText(this, value), ignored -> ConfigOptionStorage.getEnum(key, enumClass), (ignored, option, value) -> ConfigOptionStorage.setEnum(key, value));
public SimpleOption<E> asOption() {
return new SimpleOption<>(translationKey, SimpleOption.emptyTooltip(),
(text, value) -> getValueText(this, value),
new SimpleOption.PotentialValuesBasedCallbacks<>(Arrays.asList(enumClass.getEnumConstants()),
Codec.STRING.xmap(
string -> Arrays.stream(enumClass.getEnumConstants()).filter(e -> e.name().toLowerCase().equals(string)).findAny().orElse(null),
newValue -> newValue.name().toLowerCase()
)),
defaultValue, value -> ConfigOptionStorage.setEnum(key, value));
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terraformersmc.modmenu.config.option;

import net.minecraft.client.option.Option;
import net.minecraft.client.option.SimpleOption;

public interface OptionConvertable {
Option asOption();
SimpleOption<?> asOption();
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public Mod getMod() {
public void bindIconTexture() {
if (this.iconLocation == null) {
this.iconLocation = new Identifier(ModMenu.MOD_ID, mod.getId() + "_icon");
NativeImageBackedTexture icon = mod.getIcon(list.getIconHandler(), 64 * this.client.options.guiScale);
NativeImageBackedTexture icon = mod.getIcon(list.getIconHandler(), 64 * this.client.options.getGuiScale().getValue());
if (icon != null) {
this.client.getTextureManager().registerTexture(this.iconLocation, icon);
} else {
Expand Down
11 changes: 9 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"fabric-resource-loader-v0": "*",
"fabric-screen-api-v1": ">=1.0.4",
"fabricloader": ">=0.12.6",
"minecraft": ">=1.18"
"minecraft": ">=1.19-"
},
"breaks" : {
"better_mod_button": "*"
Expand Down Expand Up @@ -82,7 +82,14 @@
"anatom3000",
"OroArmor",
"Vaerian",
"spnda"
"RDKRACZ",
"Hulenkius",
"XfedeX",
"spnda",
"SolidBlock",
"Tkain",
"nfitzen",
"DenaryDev"
],
"description": "Adds a mod menu to view the list of mods you have installed.",
"mixins": [
Expand Down

0 comments on commit 0094a2f

Please sign in to comment.