Prechádzať zdrojové kódy

Add feedback link

Signed-off-by: shedaniel <daniel@shedaniel.me>
shedaniel 4 rokov pred
rodič
commit
826d759f12

+ 1 - 1
RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java

@@ -99,7 +99,7 @@ public class RoughlyEnoughItemsInitializer implements ModInitializer, ClientModI
         try {
             if (!FabricLoader.getInstance().isModLoaded("cloth-config2")) {
                 RoughlyEnoughItemsState.error("Cloth Config is not installed!", "https://www.curseforge.com/minecraft/mc-mods/cloth-config/files/all");
-            } else if (SemanticVersion.parse(FabricLoader.getInstance().getModContainer("cloth-config2").get().getMetadata().getVersion().getFriendlyString()).compareTo(SemanticVersion.parse("4.10.9")) < 0) {
+            } else if (SemanticVersion.parse(FabricLoader.getInstance().getModContainer("cloth-config2").get().getMetadata().getVersion().getFriendlyString()).compareTo(SemanticVersion.parse("4.11.14")) < 0) {
                 RoughlyEnoughItemsState.error("Your Cloth Config version is too old!", "https://www.curseforge.com/minecraft/mc-mods/cloth-config/files/all");
             }
         } catch (VersionParsingException e) {

+ 58 - 13
RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java

@@ -43,11 +43,11 @@ import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.JsonNull;
 import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.JsonObject;
 import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.JsonPrimitive;
 import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.api.SyntaxError;
-import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
-import me.shedaniel.clothconfig2.api.Modifier;
-import me.shedaniel.clothconfig2.api.ModifierKeyCode;
+import me.shedaniel.clothconfig2.api.*;
+import me.shedaniel.clothconfig2.gui.AbstractConfigScreen;
 import me.shedaniel.clothconfig2.gui.GlobalizedClothConfigScreen;
 import me.shedaniel.clothconfig2.gui.entries.KeyCodeEntry;
+import me.shedaniel.clothconfig2.gui.entries.TextListEntry;
 import me.shedaniel.clothconfig2.impl.EasingMethod;
 import me.shedaniel.rei.RoughlyEnoughItemsCore;
 import me.shedaniel.rei.api.ConfigManager;
@@ -64,23 +64,23 @@ import me.shedaniel.rei.gui.config.entry.*;
 import me.shedaniel.rei.gui.credits.CreditsScreen;
 import me.shedaniel.rei.impl.filtering.FilteringRule;
 import me.shedaniel.rei.impl.filtering.rules.ManualFilteringRule;
+import me.shedaniel.rei.utils.ImmutableLiteralText;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
 import net.fabricmc.loader.api.FabricLoader;
+import net.minecraft.ChatFormatting;
 import net.minecraft.Util;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.Font;
 import net.minecraft.client.gui.components.AbstractButton;
 import net.minecraft.client.gui.components.Button;
+import net.minecraft.client.gui.components.events.GuiEventListener;
 import net.minecraft.client.gui.screens.Screen;
 import net.minecraft.client.renderer.MultiBufferSource;
 import net.minecraft.client.resources.language.I18n;
 import net.minecraft.nbt.CompoundTag;
 import net.minecraft.nbt.TagParser;
-import net.minecraft.network.chat.CommonComponents;
-import net.minecraft.network.chat.Component;
-import net.minecraft.network.chat.TextComponent;
-import net.minecraft.network.chat.TranslatableComponent;
+import net.minecraft.network.chat.*;
 import net.minecraft.util.Mth;
 import net.minecraft.util.Tuple;
 import net.minecraft.world.InteractionResult;
@@ -89,10 +89,7 @@ import org.jetbrains.annotations.ApiStatus;
 
 import java.lang.reflect.Method;
 import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 
 import static me.shedaniel.autoconfig.util.Utils.getUnsafely;
 import static me.shedaniel.autoconfig.util.Utils.setUnsafely;
@@ -174,7 +171,7 @@ public class ConfigManagerImpl implements ConfigManager {
                         Collections.singletonList(new RecipeScreenTypeEntry(220, new TranslatableComponent(i13n), getUnsafely(field, config, RecipeScreenType.UNSET), getUnsafely(field, defaults), type -> setUnsafely(field, config, type)))
                 , (field) -> field.getType() == RecipeScreenType.class, ConfigObjectImpl.UseSpecialRecipeTypeScreen.class);
         guiRegistry.registerAnnotationProvider((i13n, field, config, defaults, guiProvider) ->
-                        Collections.singletonList(new SearchFilterSyntaxHighlightingEntry( new TranslatableComponent(i13n), getUnsafely(field, config, SyntaxHighlightingMode.COLORFUL), getUnsafely(field, defaults), type -> setUnsafely(field, config, type)))
+                        Collections.singletonList(new SearchFilterSyntaxHighlightingEntry(new TranslatableComponent(i13n), getUnsafely(field, config, SyntaxHighlightingMode.COLORFUL), getUnsafely(field, defaults), type -> setUnsafely(field, config, type)))
                 , (field) -> field.getType() == SyntaxHighlightingMode.class, ConfigObjectImpl.UseSpecialSearchFilterSyntaxHighlightingScreen.class);
         guiRegistry.registerAnnotationProvider((i13n, field, config, defaults, guiProvider) ->
                         REIHelper.getInstance().getPreviousContainerScreen() == null || Minecraft.getInstance().getConnection() == null || Minecraft.getInstance().getConnection().getRecipeManager() == null ?
@@ -231,6 +228,41 @@ public class ConfigManagerImpl implements ConfigManager {
     @SuppressWarnings("deprecation")
     @Override
     public Screen getConfigScreen(Screen parent) {
+        class EmptyEntry extends AbstractConfigListEntry<Object> {
+            private final int height;
+            
+            public EmptyEntry(int height) {
+                super(new TextComponent(UUID.randomUUID().toString()), false);
+                this.height = height;
+            }
+            
+            public int getItemHeight() {
+                return this.height;
+            }
+            
+            public Object getValue() {
+                return null;
+            }
+            
+            public Optional<Object> getDefaultValue() {
+                return Optional.empty();
+            }
+            
+            public boolean isMouseInside(int mouseX, int mouseY, int x, int y, int entryWidth, int entryHeight) {
+                return false;
+            }
+            
+            public void save() {
+            }
+            
+            public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isHovered, float delta) {
+            }
+            
+            public List<? extends GuiEventListener> children() {
+                return Collections.emptyList();
+            }
+        }
+        
         try {
             if (!detectWorkingOptifabric()) {
                 List<Tuple<String, String>> warnings = Lists.newArrayList();
@@ -261,6 +293,19 @@ public class ConfigManagerImpl implements ConfigManager {
                     builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, new ReloadPluginsEntry(220));
                 }
                 return builder.setAfterInitConsumer(screen -> {
+                    TextListEntry feedbackEntry = ConfigEntryBuilder.create().startTextDescription(
+                            new TranslatableComponent("text.rei.feedback", new TranslatableComponent("text.rei.feedback.link")
+                                    .withStyle(style -> style
+                                            .withColor(TextColor.fromRgb(0xff1fc3ff))
+                                            .withUnderlined(true)
+                                            .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://forms.gle/5tdnK5WN1wng78pV8"))
+                                            .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ImmutableLiteralText("https://forms.gle/5tdnK5WN1wng78pV8")))
+                                    ))
+                                    .withStyle(ChatFormatting.GRAY)
+                    ).build();
+                    feedbackEntry.setScreen((AbstractConfigScreen) screen);
+                    ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) feedbackEntry);
+                    ((GlobalizedClothConfigScreen) screen).listWidget.children().add(0, (AbstractConfigEntry) new EmptyEntry(4));
                     ((ScreenHooks) screen).cloth$addButtonWidget(new Button(screen.width - 104, 4, 100, 20, new TranslatableComponent("text.rei.credits"), button -> {
                         MutableLong current = new MutableLong(0);
                         CreditsScreen creditsScreen = new CreditsScreen(screen);
@@ -277,7 +322,7 @@ public class ConfigManagerImpl implements ConfigManager {
                         ((GlobalizedClothConfigScreen) screen).listWidget.bottom -= 10;
                         ((ScreenHooks) screen).cloth$addButtonWidget(new AbstractButton(0, screen.height - 40, screen.width, 10, new TextComponent(new String(BaseEncoding.base64().decode("TWVycnkgQ2hyaXN0bWFz")))) {
                             @Override
-                            public void onPress() { 
+                            public void onPress() {
                             }
                             
                             @Override

+ 0 - 2
build.gradle

@@ -208,8 +208,6 @@ curseforge {
             changelogType = "html"
             changelog = releaseChangelog
             addGameVersion "1.16-Snapshot"
-            addGameVersion "1.16.2"
-            addGameVersion "1.16.3"
             addGameVersion "1.16.4"
             addGameVersion "1.16.5"
             addGameVersion "Java 8"

+ 2 - 2
gradle.properties

@@ -1,10 +1,10 @@
 org.gradle.jvmargs=-Xmx3G
 base_version=5.10
-supported_version=1.16.2/3/4/5
+supported_version=1.16.4/5
 minecraft_version=1.16.5
 fabricloader_version=0.11.1
 cloth_client_events_v0_version=1.5.47
-cloth_config_version=4.10.12
+cloth_config_version=4.11.14
 modmenu_version=1.16.7
 fabric_api=0.30.0+1.16
 api_include=me.shedaniel.cloth.api:cloth-client-events-v0,me.shedaniel.cloth:config-2,me.sargunvohra.mcmods:autoconfig1u,net.fabricmc.fabric-api:fabric-api-base

+ 2 - 0
src/main/resources/assets/roughlyenoughitems/lang/en_us.json

@@ -8,6 +8,8 @@
   "text.rei.cheating_limited_creative_enabled": "§aCheating Enabled (Using Creative)",
   "text.rei.no_permission_cheat": "Operator permissions are required to cheat items",
   "text.rei.search.field.suggestion": "Search...",
+  "text.rei.feedback": "Any feedback you want to give to the REI developer? %s to submit your feedback!",
+  "text.rei.feedback.link": "Click me to visit the Google Form",
   "category.rei.crafting": "Crafting",
   "category.rei.smelting": "Smelting",
   "category.rei.smelting.fuel": "Fuel",