diff options
| author | shedaniel <daniel@shedaniel.me> | 2020-06-11 19:15:16 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2020-06-11 19:15:16 +0800 |
| commit | 4755b58cc468d8711f21c42fb2f51357da5ca851 (patch) | |
| tree | 32437a186542a6b0db9e9876cfaace080e8e0d68 | |
| parent | 14802dfe0c02bd5b9c442672de62f4f113524954 (diff) | |
| download | RoughlyEnoughItems-4755b58cc468d8711f21c42fb2f51357da5ca851.tar.gz RoughlyEnoughItems-4755b58cc468d8711f21c42fb2f51357da5ca851.tar.bz2 RoughlyEnoughItems-4755b58cc468d8711f21c42fb2f51357da5ca851.zip | |
Rewritten Config Screen
Signed-off-by: shedaniel <daniel@shedaniel.me>
41 files changed, 1103 insertions, 734 deletions
diff --git a/build.gradle b/build.gradle index 7c7b1ede7..93be9fdbb 100755 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,7 @@ license { repositories { maven { url "https://dl.bintray.com/shedaniel/legacy-yarn-updated" } + maven { url "https://dl.bintray.com/shedaniel/shedaniel-mods" } } jar { @@ -48,24 +49,26 @@ dependencies { mappings("me.shedaniel:legacy-yarn:${project.yarn_version}:v2") modApi("net.fabricmc:fabric-loader:${project.fabricloader_version}") modApi("net.fabricmc.fabric-api:fabric-api:${project.fabric_api}") { - exclude(group: "net.fabricmc") exclude(module: "fabric-biomes-v1") } - modApi("me.shedaniel.cloth:cloth-events:${cloth_events_version}") { - transitive = false + modApi("me.shedaniel.cloth.api:cloth-client-events-v0:${cloth_client_events_v0_version}") { + transitive(false) } modApi("me.shedaniel.cloth:config-2:${cloth_config_version}") { - exclude module: "fabric-api" + exclude(module: "fabric-api") } modApi("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig1u}") { - exclude module: "fabric-api" + exclude(module: "fabric-api") } modApi("org.jetbrains:annotations:19.0.0") modCompileOnly("io.github.prospector:modmenu:${modmenu_version}") { - transitive = false + transitive(false) } modRuntime("io.github.prospector:modmenu:${modmenu_version}") { - transitive = false + transitive(false) + } + modRuntime("me.shedaniel:SmoothScrollingEverywhere:3.0.3-unstable") { + transitive(false) } afterEvaluate { def listAdded = new ArrayList(Arrays.asList((api_exculde as String).split(','))) diff --git a/gradle.properties b/gradle.properties index 93eb43bcc..32b88a904 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,14 @@ org.gradle.jvmargs=-Xmx3G -mod_version=4.4.3 +mod_version=4.5.0 supported_version=1.16-pre3 minecraft_version=1.16-pre3 yarn_version=1.16-pre3+build.1+legacy.20w09a+build.8 fabricloader_version=0.8.7+build.201 -cloth_events_version=2.2.0-unstable -cloth_config_version=4.5.2 +cloth_client_events_v0_version=1.0.2 +cloth_config_version=4.5.3 modmenu_version=1.12.0+build.14 -fabric_api=0.11.7+build.356-1.16 -autoconfig1u=3.2.1-unstable -api_include=me.shedaniel.cloth:cloth-events,me.shedaniel.cloth:config-2,me.sargunvohra.mcmods:autoconfig1u +fabric_api=0.11.8+build.357-1.16 +autoconfig1u=3.2.0-unstable +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 api_exculde= #api_include=me.shedaniel.cloth:cloth-events,me.shedaniel.cloth:config-2,me.sargunvohra.mcmods:autoconfig1u,org.jetbrains:annotations,net.fabricmc.fabric-api:fabric-
\ No newline at end of file diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java index c9a5a45ba..85e8bd694 100644 --- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java +++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java @@ -25,7 +25,7 @@ package me.shedaniel.rei; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import me.shedaniel.cloth.hooks.ClothClientHooks; +import me.shedaniel.cloth.api.client.events.v0.ClothClientHooks; import me.shedaniel.math.api.Executor; import me.shedaniel.rei.api.*; import me.shedaniel.rei.api.plugins.REIPluginV0; @@ -321,14 +321,14 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer { if (screen instanceof ContainerScreen) ScreenHelper.setPreviousContainerScreen((ContainerScreen<?>) screen); boolean alreadyAdded = false; - for (Element element : Lists.newArrayList(screenHooks.cloth_getChildren())) + for (Element element : Lists.newArrayList(screenHooks.cloth$getChildren())) if (ContainerScreenOverlay.class.isAssignableFrom(element.getClass())) if (alreadyAdded) - screenHooks.cloth_getChildren().remove(element); + screenHooks.cloth$getChildren().remove(element); else alreadyAdded = true; if (!alreadyAdded) - screenHooks.cloth_getChildren().add(ScreenHelper.getLastOverlay(true, false)); + screenHooks.cloth$getChildren().add(ScreenHelper.getLastOverlay(true, false)); }); ClothClientHooks.SCREEN_RENDER_POST.register((matrices, minecraftClient, screen, i, i1, v) -> { if (shouldReturn(screen)) diff --git a/src/main/java/me/shedaniel/rei/api/ConfigObject.java b/src/main/java/me/shedaniel/rei/api/ConfigObject.java index 52b7fe664..448c3ccb8 100644 --- a/src/main/java/me/shedaniel/rei/api/ConfigObject.java +++ b/src/main/java/me/shedaniel/rei/api/ConfigObject.java @@ -24,12 +24,11 @@ package me.shedaniel.rei.api; import me.shedaniel.clothconfig2.api.ModifierKeyCode; -import me.shedaniel.rei.gui.config.ItemListOrdering; +import me.shedaniel.rei.gui.config.EntryPanelOrdering; import me.shedaniel.rei.gui.config.RecipeBorderType; import me.shedaniel.rei.gui.config.RecipeScreenType; import me.shedaniel.rei.gui.config.SearchFieldLocation; import me.shedaniel.rei.impl.ConfigManagerImpl; -import me.shedaniel.rei.impl.ConfigObjectImpl; import org.jetbrains.annotations.ApiStatus; import java.util.List; @@ -51,7 +50,7 @@ public interface ConfigObject { void setCheating(boolean cheating); - ItemListOrdering getItemListOrdering(); + EntryPanelOrdering getItemListOrdering(); boolean isItemListAscending(); @@ -137,9 +136,6 @@ public interface ConfigObject { double getEntrySize(); - @ApiStatus.Internal - ConfigObjectImpl.General getGeneral(); - boolean isUsingCompactTabs(); boolean isLowerConfigButton(); diff --git a/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java index d57a9bbfd..28faa8b37 100644 --- a/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/PreRecipeViewingScreen.java @@ -34,14 +34,13 @@ import me.shedaniel.rei.gui.config.RecipeScreenType; import me.shedaniel.rei.gui.widget.Widget; import me.shedaniel.rei.gui.widget.WidgetWithBounds; import me.shedaniel.rei.impl.ScreenHelper; -import net.minecraft.class_5348; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.util.NarratorManager; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.Text; +import net.minecraft.text.StringRenderable; import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; @@ -128,7 +127,7 @@ public class PreRecipeViewingScreen extends Screen { this.drawCenteredText(matrices, this.textRenderer, this.title, this.width / 2, 20, 16777215); if (showTips) { int i = 30; - for (class_5348 s : this.textRenderer.wrapStringToWidthAsList(new TranslatableText("text.rei.recipe_screen_type.selection.sub").formatted(Formatting.GRAY), width - 30)) { + for (StringRenderable s : this.textRenderer.wrapStringToWidthAsList(new TranslatableText("text.rei.recipe_screen_type.selection.sub").formatted(Formatting.GRAY), width - 30)) { this.drawCenteredText(matrices, this.textRenderer, s, width / 2, i, -1); i += 10; } diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeDisplayExporter.java b/src/main/java/me/shedaniel/rei/gui/RecipeDisplayExporter.java index 3d9b98081..fe6007d1b 100644 --- a/src/main/java/me/shedaniel/rei/gui/RecipeDisplayExporter.java +++ b/src/main/java/me/shedaniel/rei/gui/RecipeDisplayExporter.java @@ -23,7 +23,6 @@ package me.shedaniel.rei.gui; -import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.gui.toast.ExportRecipeIdentifierToast; @@ -36,7 +35,7 @@ import net.minecraft.client.resource.language.I18n; import net.minecraft.client.texture.NativeImage; import net.minecraft.client.util.Window; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.resource.ResourceImpl; +import net.minecraft.util.Util; import org.jetbrains.annotations.ApiStatus; import java.io.File; @@ -105,7 +104,7 @@ public final class RecipeDisplayExporter extends Widget { strippedImage.setPixelRgba(x, y, nativeImage.getPixelRgba(x + (int) (rectangle.x * window.getScaleFactor()), y + (int) (rectangle.y * window.getScaleFactor()))); } } - ResourceImpl.RESOURCE_IO_EXECUTOR.execute(() -> { + Util.method_27958().execute(() -> { try { File export = new File(minecraft.runDirectory, "rei_exports"); export.mkdirs(); diff --git a/src/main/java/me/shedaniel/rei/gui/WarningAndErrorScreen.java b/src/main/java/me/shedaniel/rei/gui/WarningAndErrorScreen.java index 4f0fadedc..a9baafcea 100644 --- a/src/main/java/me/shedaniel/rei/gui/WarningAndErrorScreen.java +++ b/src/main/java/me/shedaniel/rei/gui/WarningAndErrorScreen.java @@ -25,7 +25,6 @@ package me.shedaniel.rei.gui; import me.shedaniel.clothconfig2.gui.widget.DynamicNewSmoothScrollingEntryListWidget; import me.shedaniel.rei.RoughlyEnoughItemsState; -import net.minecraft.class_5348; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; @@ -37,6 +36,7 @@ import net.minecraft.client.util.TextCollector; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.sound.SoundEvents; import net.minecraft.text.LiteralText; +import net.minecraft.text.StringRenderable; import net.minecraft.text.Style; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -70,13 +70,13 @@ public class WarningAndErrorScreen extends Screen { } private void addText(Text string) { - for (class_5348 s : textRenderer.wrapStringToWidthAsList(string, width - 80)) { + for (StringRenderable s : textRenderer.wrapStringToWidthAsList(string, width - 80)) { listWidget.creditsAddEntry(new TextItem(s)); } } private void addLink(Text string, String link) { - for (class_5348 s : textRenderer.wrapStringToWidthAsList(string, width - 80)) { + for (StringRenderable s : textRenderer.wrapStringToWidthAsList(string, width - 80)) { listWidget.creditsAddEntry(new LinkItem(s, link)); } } @@ -214,9 +214,9 @@ public class WarningAndErrorScreen extends Screen { } private static class TextItem extends StringItem { - private class_5348 text; + private StringRenderable text; - public TextItem(class_5348 text) { + public TextItem(StringRenderable text) { this.text = text; } @@ -242,11 +242,11 @@ public class WarningAndErrorScreen extends Screen { } private class LinkItem extends StringItem { - private class_5348 text; + private StringRenderable text; private String link; private boolean contains; - public LinkItem(class_5348 text, String link) { + public LinkItem(StringRenderable text, String link) { this.text = text; this.link = link; } @@ -256,12 +256,12 @@ public class WarningAndErrorScreen extends Screen { contains = mouseX >= x && mouseX <= x + entryWidth && mouseY >= y && mouseY <= y + entryHeight; if (contains) { WarningAndErrorScreen.this.renderTooltip(matrices, new LiteralText("Click to open link."), mouseX, mouseY); - class_5348 underlined = text.visit(new class_5348.StyledVisitor<class_5348>() { + StringRenderable underlined = text.visit(new StringRenderable.StyledVisitor<StringRenderable>() { TextCollector collector = new TextCollector(); @Override - public Optional<class_5348> accept(Style style, String asString) { - collector.add(class_5348.method_29431(asString, style)); + public Optional<StringRenderable> accept(Style style, String asString) { + collector.add(StringRenderable.styled(asString, style)); return Optional.of(collector.getCombined()); } }, Style.EMPTY.withFormatting(Formatting.UNDERLINE)).orElse(text); diff --git a/src/main/java/me/shedaniel/rei/gui/config/AppearanceTheme.java b/src/main/java/me/shedaniel/rei/gui/config/AppearanceTheme.java new file mode 100644 index 000000000..43bf52eeb --- /dev/null +++ b/src/main/java/me/shedaniel/rei/gui/config/AppearanceTheme.java @@ -0,0 +1,40 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.shedaniel.rei.gui.config; + +import me.shedaniel.clothconfig2.gui.entries.SelectionListEntry; +import net.minecraft.client.resource.language.I18n; +import org.jetbrains.annotations.NotNull; + +import java.util.Locale; + +public enum AppearanceTheme implements SelectionListEntry.Translatable { + LIGHT, + DARK; + + @Override + public @NotNull String getKey() { + return I18n.translate("config.roughlyenoughitems.theme." + name().toLowerCase(Locale.ROOT)); + } +} diff --git a/src/main/java/me/shedaniel/rei/gui/config/ConfigButtonPosition.java b/src/main/java/me/shedaniel/rei/gui/config/ConfigButtonPosition.java new file mode 100644 index 000000000..b07238fc9 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/gui/config/ConfigButtonPosition.java @@ -0,0 +1,40 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.shedaniel.rei.gui.config; + +import me.shedaniel.clothconfig2.gui.entries.SelectionListEntry; +import net.minecraft.client.resource.language.I18n; +import org.jetbrains.annotations.NotNull; + +import java.util.Locale; + +public enum ConfigButtonPosition implements SelectionListEntry.Translatable { + UPPER, + LOWER; + + @Override + public @NotNull String getKey() { + return I18n.translate("config.roughlyenoughitems.layout.configButtonLocation." + name().toLowerCase(Locale.ROOT)); + } +} diff --git a/src/main/java/me/shedaniel/rei/gui/config/DisplayPanelLocation.java b/src/main/java/me/shedaniel/rei/gui/config/DisplayPanelLocation.java new file mode 100644 index 000000000..a9022ff09 --- /dev/null +++ b/src/main/java/me/shedaniel/rei/gui/config/DisplayPanelLocation.java @@ -0,0 +1,40 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020 shedaniel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.shedaniel.rei.gui.config; + +import me.shedaniel.clothconfig2.gui.entries.SelectionListEntry; +import net.minecraft.client.resource.language.I18n; +import org.jetbrains.annotations.NotNull; + +import java.util.Locale; + +public enum DisplayPanelLocation implements SelectionListEntry.Translatable { + LEFT, + RIGHT; + + @Override + public @NotNull String getKey() { + return I18n.translate("config.roughlyenoughitems.accessibility.displayPanelLocation." + name().toLowerCase(Locale.ROOT)); + } +} diff --git a/src/main/java/me/shedaniel/rei/gui/config/ItemListOrdering.java b/src/main/java/me/shedaniel/rei/gui/config/EntryPanelOrdering.java index 9ef4c366e..fb11df19a 100644 --- a/src/main/java/me/shedaniel/rei/gui/config/ItemListOrdering.java +++ b/src/main/java/me/shedaniel/rei/gui/config/EntryPanelOrdering.java @@ -26,15 +26,15 @@ package me.shedaniel.rei.gui.config; import org.jetbrains.annotations.ApiStatus; @ApiStatus.Internal -public enum ItemListOrdering { +public enum EntryPanelOrdering { - registry("ordering.rei.registry"), - name("ordering.rei.name"), - item_groups("ordering.rei.item_groups"); + REGISTRY("ordering.rei.registry"), + NAME("ordering.rei.name"), + GROUPS("ordering.rei.item_groups"); private String nameTranslationKey; - ItemListOrdering(String nameTranslationKey) { + EntryPanelOrdering(String nameTranslationKey) { this.nameTranslationKey = nameTranslationKey; } diff --git a/src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingConfig.java b/src/main/java/me/shedaniel/rei/gui/config/EntryPanelOrderingConfig.java index 1b1f0a89b..d64e0cb08 100644 --- a/src/main/java/me/shedaniel/rei/gui/config/ItemListOrderingConfig.java +++ b/src/main/java/me/shedaniel/rei/gui/config/EntryPanelOrderingConfig.java @@ -27,28 +27,28 @@ import net.minecraft.client.resource.language.I18n; import org.jetbrains.annotations.ApiStatus; @ApiStatus.Internal -public enum ItemListOrderingConfig { - REGISTRY_ASCENDING(ItemListOrdering.registry, true), - NAME_ASCENDING(ItemListOrdering.name, true), - GROUPS_ASCENDING(ItemListOrdering.item_groups, true), - REGISTRY_DESCENDING(ItemListOrdering.registry, false), - NAME_DESCENDING(ItemListOrdering.name, false), - GROUPS_DESCENDING(ItemListOrdering.item_groups, false); +public enum EntryPanelOrderingConfig { + REGISTRY_ASCENDING(EntryPanelOrdering.REGISTRY, true), + NAME_ASCENDING(EntryPanelOrdering.NAME, true), + GROUPS_ASCENDING(EntryPanelOrdering.GROUPS, true), + REGISTRY_DESCENDING(EntryPanelOrdering.REGISTRY, false), + NAME_DESCENDING(EntryPanelOrdering.NAME, false), + GROUPS_DESCENDING(EntryPanelOrdering.GROUPS, false); - private ItemListOrdering ordering; + private EntryPanelOrdering ordering; private boolean isAscending; - ItemListOrderingConfig(ItemListOrdering ordering, boolean isAscending) { + EntryPanelOrderingConfig(EntryPanelOrdering ordering, boolean isAscending) { this.ordering = ordering; this.isAscending = isAscending; } - public static ItemListOrderingConfig from(ItemListOrdering ordering, boolean isAscending) { + public static EntryPanelOrderingConfig from(EntryPanelOrdering ordering, boolean isAscending) { int index = ordering.ordinal() + (isAscending ? 0 : 3); return values()[index]; } - public ItemListOrdering getOrdering() { + public EntryPanelOrdering getOrdering() { return ordering; } diff --git a/src/main/java/me/shedaniel/rei/gui/config/SearchFieldLocation.java b/src/main/java/me/shedaniel/rei/gui/config/SearchFieldLocation.java index 5b39e2150..6dd19316a 100644 --- a/< |
