diff options
| author | shedaniel <daniel@shedaniel.me> | 2023-02-18 21:01:50 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2024-04-16 00:38:18 +0900 |
| commit | eb2b1d1ecc00ba435e97b5d89879ebe379fd7390 (patch) | |
| tree | 7a063c22e452015647ee32a7ea5726fac305113f | |
| parent | 1381bd6d9babec1b701b2e74918c5f885e51b709 (diff) | |
| download | RoughlyEnoughItems-eb2b1d1ecc00ba435e97b5d89879ebe379fd7390.tar.gz RoughlyEnoughItems-eb2b1d1ecc00ba435e97b5d89879ebe379fd7390.tar.bz2 RoughlyEnoughItems-eb2b1d1ecc00ba435e97b5d89879ebe379fd7390.zip | |
Remove isJEICompatibilityLayerEnabled in ConfigObject
4 files changed, 18 insertions, 92 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java b/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java index 5eccfc03a..87d242ad3 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java @@ -392,5 +392,14 @@ public interface ConfigObject { SearchMode getModSearchMode(); - boolean isJEICompatibilityLayerEnabled(); + /** + * Returns whether the JEI compatibility layer is enabled. + * + * @return whether the JEI compatibility layer is enabled + * @deprecated the JEI compatibility layer is not bundled with REI anymore + */ + @Deprecated(forRemoval = true) + default boolean isJEICompatibilityLayerEnabled() { + return false; + } } diff --git a/build.gradle b/build.gradle index 18a3a4456..37c68cc53 100755 --- a/build.gradle +++ b/build.gradle @@ -81,7 +81,6 @@ allprojects { license { header rootProject.file("HEADER") include "**/*.java" - exclude "mezz/jei/api/**/*.java" ext { name = "shedaniel" diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java index e79892688..896ca434e 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java @@ -24,7 +24,6 @@ package me.shedaniel.rei.impl.client.config; import com.mojang.blaze3d.platform.InputConstants; -import dev.architectury.platform.Platform; import me.shedaniel.autoconfig.ConfigData; import me.shedaniel.autoconfig.annotation.Config; import me.shedaniel.autoconfig.annotation.ConfigEntry; @@ -587,15 +586,6 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { return advanced.search.modSearch; } - @Override - public boolean isJEICompatibilityLayerEnabled() { - return Platform.isForge() && advanced.enableJeiCompatibilityLayer; - } - - public void setJEICompatibilityLayerEnabled(boolean value) { - advanced.enableJeiCompatibilityLayer = value; - } - @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) @interface DontApplyFieldName {} @@ -704,8 +694,6 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { private Miscellaneous miscellaneous = new Miscellaneous(); @ConfigEntry.Gui.CollapsibleObject(startExpanded = true) public Filtering filtering = new Filtering(); - @ConfigEntry.Gui.Excluded - public boolean enableJeiCompatibilityLayer = true; public static class Tooltips { @Comment("Declares whether REI should append mod names to entries.") private boolean appendModNames = true; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/UncertainDisplayViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/UncertainDisplayViewingScreen.java index 14b2c179c..f45c6927d 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/UncertainDisplayViewingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/UncertainDisplayViewingScreen.java @@ -26,29 +26,20 @@ package me.shedaniel.rei.impl.client.gui.screen; import com.google.common.collect.Lists; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Matrix4f; -import dev.architectury.platform.Platform; import it.unimi.dsi.fastutil.booleans.BooleanConsumer; import me.shedaniel.clothconfig2.api.ScissorsHandler; -import me.shedaniel.clothconfig2.api.animator.NumberAnimator; -import me.shedaniel.clothconfig2.api.animator.ValueAnimator; import me.shedaniel.clothconfig2.gui.widget.DynamicNewSmoothScrollingEntryListWidget; import me.shedaniel.clothconfig2.impl.EasingMethod; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.RoughlyEnoughItemsCore; -import me.shedaniel.rei.RoughlyEnoughItemsCoreClient; import me.shedaniel.rei.api.client.REIRuntime; -import me.shedaniel.rei.api.client.config.ConfigManager; import me.shedaniel.rei.api.client.gui.config.DisplayScreenType; import me.shedaniel.rei.api.client.gui.widgets.Button; import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds; import me.shedaniel.rei.api.client.gui.widgets.Widgets; -import me.shedaniel.rei.impl.client.config.ConfigManagerImpl; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.components.AbstractSliderButton; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; @@ -77,9 +68,6 @@ public class UncertainDisplayViewingScreen extends Screen { private Screen parent; private Widget slider; private boolean showTips; - public NumberAnimator<Double> scroll = ValueAnimator.ofDouble(); - private List<String> allModsUsingJEI = null; - private boolean jeiEnabled = false; public UncertainDisplayViewingScreen(Screen parent, DisplayScreenType type, boolean showTips, BooleanConsumer callback) { super(Component.empty()); @@ -92,17 +80,9 @@ public class UncertainDisplayViewingScreen extends Screen { this.original = type == DisplayScreenType.ORIGINAL; moveFrameTo(original ? 0 : 1, false, 0); } - this.scroll.setAs(0); this.callback = callback; this.parent = parent; this.showTips = showTips; - if (showTips && false && Platform.isForge()) { -// this.jeiEnabled = ConfigObject.getInstance().isJEICompatibilityLayerEnabled(); -// allModsUsingJEI = ClientInternals.getJeiCompatMods().stream() -// .distinct() -// .map(ClientHelper.getInstance()::getModFromModId) -// .collect(Collectors.toList()); - } } public final double clamp(double v) { @@ -131,47 +111,15 @@ public class UncertainDisplayViewingScreen extends Screen { this._children().add(button = Widgets.createButton(new Rectangle(width / 2 - 100, height - 40, 200, 20), Component.empty()) .onRender((matrices, button) -> { button.setEnabled(isSet); - if (scroll.target() != 0 && allModsUsingJEI != null) { - button.setText(Component.translatable("gui.done")); - } else { - button.setText(isSet ? Component.translatable("text.rei.select") : Component.translatable("config.roughlyenoughitems.recipeScreenType.unset")); - } + button.setText(Component.translatable("gui.done")); }) .onClick(button -> { - if (scroll.target() == 0 && allModsUsingJEI != null) { - scroll.setTo(200, 450); - } else if (allModsUsingJEI != null && jeiEnabled) { - ConfigManagerImpl.getInstance().getConfig().setJEICompatibilityLayerEnabled(jeiEnabled); - ConfigManager.getInstance().saveConfig(); - RoughlyEnoughItemsCore.PERFORMANCE_LOGGER.clear(); - RoughlyEnoughItemsCoreClient.reloadPlugins(null, null); - Minecraft.getInstance().setScreen(REIRuntime.getInstance().getPreviousScreen()); - } else { - callback.accept(original); - } + callback.accept(original); })); - this.widgets.add(transformScroll(new ScreenTypeSelection(width / 2 - 200 - 5, height / 2 - 112 / 2 - 10, DisplayScreenType.ORIGINAL))); - this.widgets.add(transformScroll(Widgets.createLabel(new Point(width / 2 - 200 - 5 + 104, height / 2 - 112 / 2 + 115), Component.translatable("config.roughlyenoughitems.recipeScreenType.original")).noShadow().color(-1124073473))); - this.widgets.add(transformScroll(new ScreenTypeSelection(width / 2 + 5, height / 2 - 112 / 2 - 10, DisplayScreenType.COMPOSITE))); - this.widgets.add(transformScroll(Widgets.createLabel(new Point(width / 2 + 5 + 104, height / 2 - 112 / 2 + 115), Component.translatable("config.roughlyenoughitems.recipeScreenType.composite")).noShadow().color(-1124073473))); - this.widgets.add(slider = transformScroll(Widgets.wrapVanillaWidget(new AbstractSliderButton(width / 2 - 100, height * 2 - 64, 200, 20, Component.translatable("text.rei.jei_compat.false"), 0) { - @Override - protected void updateMessage() { - setMessage(Component.translatable("text.rei.jei_compat." + (jeiEnabled = value == 1f))); - } - - @Override - protected void applyValue() { - - } - - @Override - public void renderButton(PoseStack poseStack, int i, int j, float f) { - y = UncertainDisplayViewingScreen.this.height * 2 - 64; - super.renderButton(poseStack, i, j, f); - y = UncertainDisplayViewingScreen.this.height * 2 - 64 - (int) (scroll.floatValue() / 200f * height); - } - }))); + this.widgets.add(new ScreenTypeSelection(width / 2 - 200 - 5, height / 2 - 112 / 2 - 10, DisplayScreenType.ORIGINAL)); + this.widgets.add(Widgets.createLabel(new Point(width / 2 - 200 - 5 + 104, height / 2 - 112 / 2 + 115), Component.translatable("config.roughlyenoughitems.recipeScreenType.original")).noShadow().color(-1124073473)); + this.widgets.add(new ScreenTypeSelection(width / 2 + 5, height / 2 - 112 / 2 - 10, DisplayScreenType.COMPOSITE)); + this.widgets.add(Widgets.createLabel(new Point(width / 2 + 5 + 104, height / 2 - 112 / 2 + 115), Component.translatable("config.roughlyenoughitems.recipeScreenType.composite")).noShadow().color(-1124073473)); this._children().addAll(widgets); } @@ -179,38 +127,21 @@ public class UncertainDisplayViewingScreen extends Screen { return (List<GuiEventListener>) children(); } - private Widget transformScroll(Widget widget) { - return Widgets.withTranslate(widget, () -> Matrix4f.createTranslateMatrix(0, -(scroll.floatValue() / 200f * height), 0)); - } - @Override public void render(PoseStack matrices, int int_1, int int_2, float float_1) { - scroll.update(float_1); if (this.minecraft.level != null) { renderBackground(matrices); } else { this.fillGradient(matrices, 0, 0, this.width, this.height, -16777216, -16777216); } - if (scroll.target() == 0) { - drawCenteredString(matrices, this.font, Component.translatable("text.rei.recipe_screen_type.selection"), this.width / 2, 20, 16777215); - } else { - drawCenteredString(matrices, this.font, Component.translatable("text.rei.jei_compat"), this.width / 2, 20, 16777215); - } + drawCenteredString(matrices, this.font, Component.translatable("text.rei.recipe_screen_type.selection"), this.width / 2, 20, 16777215); ScissorsHandler.INSTANCE.scissor(new Rectangle(0, 20 + font.lineHeight + 2, width, height - 42)); if (showTips) { - float i = 32 - (scroll.floatValue() / 200f * height); + float i = 32; for (FormattedCharSequence s : this.font.split(Component.translatable("text.rei.recipe_screen_type.selection.sub").withStyle(ChatFormatting.GRAY), width - 30)) { font.drawShadow(matrices, s, width / 2 - font.width(s) / 2, i, -1); i += 10; } - if (allModsUsingJEI != null) { - i = 32 + height - (scroll.floatValue() / 200f * height); - for (FormattedCharSequence s : this.font.split(Component.translatable("text.rei.jei_compat.sub", Component.translatable("text.rei.jei_compat.sub.stability"), - Component.literal(String.join(", ", allModsUsingJEI))).withStyle(ChatFormatting.GRAY), width - 30)) { - font.drawShadow(matrices, s, width / 2 - font.width(s) / 2, i, -1); - i += 10; - } - } } super.render(matrices, int_1, int_2, float_1); for (Widget widget : widgets) { @@ -218,7 +149,6 @@ public class UncertainDisplayViewingScreen extends Screen { } if (isSet) { matrices.pushPose(); - matrices.translate(0, -(scroll.floatValue() / 200f * height), 0); updateFramePosition(float_1); int x = (int) (width / 2 - 205 + (210 * frame)); int y = height / 2 - 112 / 2 - 10; |
