Skip to content

Commit

Permalink
port to 1.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceWalkerRS committed Dec 1, 2023
1 parent 6b098c0 commit dfd458c
Show file tree
Hide file tree
Showing 30 changed files with 594 additions and 136 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ dependencies {
nests "net.ornithemc:nests:${project.minecraft_version}+build.${project.nests_build}"
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
compileOnly "org.quiltmc:quilt-loader:${project.quilt_loader_version}"
compileOnly "org.apache.logging.log4j:log4j-api:2.19.0"
compileOnly "org.apache.logging.log4j:log4j-core:2.19.0"

ploceus.dependOsl(project.osl_version)
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ maven_group = com.terraformersmc
archives_base_name = modmenu

# Dependencies
minecraft_version = 1.7.9
minecraft_version = 1.6.4
feather_build = 25
nests_build = 1
fabric_loader_version = 0.14.24
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/terraformersmc/modmenu/ModMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.terraformersmc.modmenu.config.ModMenuConfig.TitleMenuButtonStyle;
import com.terraformersmc.modmenu.config.ModMenuConfigManager;
import com.terraformersmc.modmenu.event.ModMenuEventHandler;
import com.terraformersmc.modmenu.util.GlUtil;
import com.terraformersmc.modmenu.util.ModrinthUtil;
import com.terraformersmc.modmenu.util.TranslationUtil;
import com.terraformersmc.modmenu.util.mod.Mod;
Expand All @@ -21,9 +22,7 @@
import net.fabricmc.loader.api.ModContainer;
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.ornithemc.osl.entrypoints.api.client.ClientModInitializer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -161,18 +160,18 @@ public static Text createModsButtonText(boolean title) {
GameMenuButtonStyle gameMenuStyle = ModMenuConfig.GAME_MENU_BUTTON_STYLE.getValue();
boolean isIcon = title ? titleStyle == ModMenuConfig.TitleMenuButtonStyle.ICON : gameMenuStyle == ModMenuConfig.GameMenuButtonStyle.ICON;
boolean isShort = /*title ? titleStyle == ModMenuConfig.TitleMenuButtonStyle.SHRINK :*/ false;
Text modsText = new TranslatableText("modmenu.title");
Text modsText = Text.translatable("modmenu.title");
if (ModMenuConfig.MOD_COUNT_LOCATION.getValue().isOnModsButton() && !isIcon) {
String count = ModMenu.getDisplayedModCount();
if (isShort) {
modsText.append(new LiteralText(" ")).append(new TranslatableText("modmenu.loaded.short", count));
modsText.append(Text.literal(" ")).appendTranslatable("modmenu.loaded.short", count);
} else {
String specificKey = "modmenu.loaded." + count;
String key = TranslationUtil.hasTranslation(specificKey) ? specificKey : "modmenu.loaded";
if (ModMenuConfig.EASTER_EGGS.getValue() && TranslationUtil.hasTranslation(specificKey + ".secret")) {
key = specificKey + ".secret";
}
modsText.append(new LiteralText(" ")).append(new TranslatableText(key, count));
modsText.append(Text.literal(" ")).appendTranslatable(key, count);
}
}
return modsText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.terraformersmc.modmenu.util.TranslationUtil;

import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

public class BooleanConfigOption implements ConfigOption {
private final String key, translationKey;
Expand All @@ -16,8 +15,8 @@ public BooleanConfigOption(String key, boolean defaultValue, String enabledKey,
this.key = key;
this.translationKey = TranslationUtil.translationKeyOf("option", key);
this.defaultValue = defaultValue;
this.enabledText = new TranslatableText(translationKey + "." + enabledKey);
this.disabledText = new TranslatableText(translationKey + "." + disabledKey);
this.enabledText = Text.translatable(translationKey + "." + enabledKey);
this.disabledText = Text.translatable(translationKey + "." + disabledKey);
}

public BooleanConfigOption(String key, boolean defaultValue) {
Expand Down Expand Up @@ -46,7 +45,7 @@ public boolean getDefaultValue() {

@Override
public String getValueLabel() {
return TranslationUtil.translateOptionLabel(new TranslatableText(translationKey), getValue() ? enabledText : disabledText);
return TranslationUtil.translateOptionLabel(Text.translatable(translationKey), getValue() ? enabledText : disabledText);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.terraformersmc.modmenu.util.TranslationUtil;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

import java.util.Locale;

Expand Down Expand Up @@ -44,12 +43,12 @@ public E getDefaultValue() {
}

private static <E extends Enum<E>> Text getValueText(EnumConfigOption<E> option, E value) {
return new TranslatableText(option.translationKey + "." + value.name().toLowerCase(Locale.ROOT));
return Text.translatable(option.translationKey + "." + value.name().toLowerCase(Locale.ROOT));
}

@Override
public String getValueLabel() {
return TranslationUtil.translateOptionLabel(new TranslatableText(translationKey), getValueText(this, getValue()));
return TranslationUtil.translateOptionLabel(Text.translatable(translationKey), getValueText(this, getValue()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.terraformersmc.modmenu.config.option;

import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;

import com.terraformersmc.modmenu.util.TranslationUtil;

Expand Down Expand Up @@ -32,7 +31,7 @@ public void setValue(Set<String> value) {
}

public Text getMessage() {
return new TranslatableText(translationKey);
return Text.translatable(translationKey);
}

public Set<String> getDefaultValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public class ModMenuEventHandler {
public static void register() {
KeyBindingEvents.REGISTER_KEYBINDS.register(registry -> MENU_KEY_BIND = registry.register(
"key.modmenu.open_menu",
Keyboard.KEY_NONE,
"key.categories.misc"
Keyboard.KEY_NONE
));
MinecraftClientEvents.TICK_END.register(ModMenuEventHandler::onClientEndTick);
}
Expand Down
Loading

0 comments on commit dfd458c

Please sign in to comment.