diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-08-26 16:48:42 +0900 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-08-26 21:17:48 +0900 |
| commit | a6900532610247cae49f1c782442d07d8f7b1d2d (patch) | |
| tree | 5b01e2e8a84f5fc5254b9613b15ec1ef84961133 /runtime-engine | |
| parent | d3bfd79800aacfde6617d5430ead5fdda0a506fe (diff) | |
| download | RoughlyEnoughItems-a6900532610247cae49f1c782442d07d8f7b1d2d.tar.gz RoughlyEnoughItems-a6900532610247cae49f1c782442d07d8f7b1d2d.tar.bz2 RoughlyEnoughItems-a6900532610247cae49f1c782442d07d8f7b1d2d.zip | |
It compiles now
Diffstat (limited to 'runtime-engine')
16 files changed, 327 insertions, 38 deletions
diff --git a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java index e13b0e54d..141900f2e 100644 --- a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java +++ b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java @@ -54,6 +54,7 @@ import java.lang.annotation.Target; import java.util.ArrayList; import java.util.List; +@SuppressWarnings("FieldMayBeFinal") @ApiStatus.Internal @Config(name = "roughlyenoughitems/config") @Environment(EnvType.CLIENT) diff --git a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigAddonsEntry.java b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigAddonsEntry.java index 017201a14..f05a4c98e 100644 --- a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigAddonsEntry.java +++ b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/ConfigAddonsEntry.java @@ -44,11 +44,11 @@ import java.util.Optional; @ApiStatus.Internal public class ConfigAddonsEntry extends AbstractConfigListEntry<Unit> { - private int width; - private AbstractWidget buttonWidget = new Button(0, 0, 0, 20, NarratorChatListener.NO_TITLE, button -> { + private final int width; + private final AbstractWidget buttonWidget = new Button(0, 0, 0, 20, NarratorChatListener.NO_TITLE, button -> { Minecraft.getInstance().setScreen(new ConfigAddonsScreen(Minecraft.getInstance().screen)); }); - private List<AbstractWidget> children = ImmutableList.of(buttonWidget); + private final List<AbstractWidget> children = ImmutableList.of(buttonWidget); public ConfigAddonsEntry(int width) { super(NarratorChatListener.NO_TITLE, false); diff --git a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/TitleTextEntry.java b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/TitleTextEntry.java index 3e2bdc48a..049753e9e 100644 --- a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/TitleTextEntry.java +++ b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/TitleTextEntry.java @@ -39,7 +39,7 @@ import java.util.Optional; @ApiStatus.Internal public class TitleTextEntry extends AbstractConfigListEntry<Unit> { - private Component text; + private final Component text; public TitleTextEntry(Component text) { super(NarratorChatListener.NO_TITLE, false); diff --git a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/UncertainDisplayViewingScreen.java b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/UncertainDisplayViewingScreen.java index 21ce7ac95..d8e07bc3d 100644 --- a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/UncertainDisplayViewingScreen.java +++ b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/entries/UncertainDisplayViewingScreen.java @@ -76,12 +76,12 @@ public class UncertainDisplayViewingScreen extends Screen { private boolean original; private double frame = 0; private double target = 0; - private BooleanConsumer callback; + private final BooleanConsumer callback; private Button button; - private Screen parent; + private final Screen parent; private Widget slider; - private boolean showTips; - public NumberAnimator<Double> scroll = ValueAnimator.ofDouble(); + private final boolean showTips; + public final NumberAnimator<Double> scroll = ValueAnimator.ofDouble(); private List<String> allModsUsingJEI = null; private boolean jeiEnabled = false; diff --git a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsEntryListWidget.java b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsEntryListWidget.java index 58cca6382..2182f01f2 100644 --- a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsEntryListWidget.java +++ b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsEntryListWidget.java @@ -97,7 +97,7 @@ public class CreditsEntryListWidget extends DynamicSmoothScrollingEntryListWidge } public static class TextCreditsItem extends CreditsItem { - private Component text; + private final Component text; public TextCreditsItem(Component text) { this.text = text; @@ -120,9 +120,9 @@ public class CreditsEntryListWidget extends DynamicSmoothScrollingEntryListWidge } public static class TranslationCreditsItem extends CreditsItem { - private Component language; - private List<FormattedCharSequence> translators; - private int maxWidth; + private final Component language; + private final List<FormattedCharSequence> translators; + private final int maxWidth; public TranslationCreditsItem(Component language, Component translators, int width, int maxWidth) { this.language = language; @@ -152,11 +152,11 @@ public class CreditsEntryListWidget extends DynamicSmoothScrollingEntryListWidge } public static class LinkItem extends CreditsItem { - private Component text; - private List<FormattedCharSequence> textSplit; - private String link; + private final Component text; + private final List<FormattedCharSequence> textSplit; + private final String link; private boolean contains; - private boolean rainbow; + private final boolean rainbow; public LinkItem(Component text, String link, int width, boolean rainbow) { this.text = text; diff --git a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsScreen.java b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsScreen.java index 8ca4fe7ef..70834e457 100644 --- a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsScreen.java +++ b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/gui/credits/CreditsScreen.java @@ -50,7 +50,7 @@ import java.util.stream.Collectors; @ApiStatus.Internal public class CreditsScreen extends Screen { - private Screen parent; + private final Screen parent; private AbstractButton buttonDone; private CreditsEntryListWidget entryListWidget; diff --git a/runtime-engine/filtering-entries/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java b/runtime-engine/filtering-entries/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java index 1e4df400b..fafd59de8 100644 --- a/runtime-engine/filtering-entries/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java +++ b/runtime-engine/filtering-entries/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java @@ -452,9 +452,9 @@ public class FilteringScreen extends Screen { super(Widgets.createSlot(new Point(x, y)) .noFavoritesInteractable() .noInteractable() - .disableBackground() - .disableTooltips() - .disableHighlight()); + .noBackground() + .noTooltips() + .noHighlight()); this.slot = (Slot) widget; this.backupY = y; } diff --git a/runtime-engine/filtering-entries/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRuleType.java b/runtime-engine/filtering-entries/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRuleType.java index b1f932022..930a46975 100644 --- a/runtime-engine/filtering-entries/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRuleType.java +++ b/runtime-engine/filtering-entries/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRuleType.java @@ -108,7 +108,7 @@ public class SearchFilteringRuleType implements FilteringRuleType<SearchFilterin entryStacks = EntryRegistry.getInstance().getEntryStacks().parallel() .filter(filter) .map(EntryStack::normalize) - .map(stack -> Widgets.createSlot(new Rectangle(0, 0, 18, 18)).disableBackground().entry(stack)) + .map(stack -> Widgets.createSlot(new Rectangle(0, 0, 18, 18)).noBackground().entry(stack)) .collect(Collectors.toList()); }); if (entry != null) widget.setValue(entry.getWidget().getValue()); diff --git a/runtime-engine/initialization/src/main/java/me/shedaniel/rei/impl/client/init/CoreClientInitialization.java b/runtime-engine/initialization/src/main/java/me/shedaniel/rei/impl/client/init/CoreClientInitialization.java index 44df96bc4..32168ec63 100644 --- a/runtime-engine/initialization/src/main/java/me/shedaniel/rei/impl/client/init/CoreClientInitialization.java +++ b/runtime-engine/initialization/src/main/java/me/shedaniel/rei/impl/client/init/CoreClientInitialization.java @@ -82,7 +82,6 @@ public class CoreClientInitialization { MutableLong startReload = new MutableLong(-1); MutableLong endReload = new MutableLong(-1); PRE_UPDATE_RECIPES.register(recipeManager -> { - PluginReloaderImpl.PERFORMANCE_LOGGER.clear(); CoreInitialization.reloadPlugins(startReload, ReloadStage.START); }); ClientRecipeUpdateEvent.EVENT.register(recipeManager -> { diff --git a/runtime-engine/initialization/src/main/java/me/shedaniel/rei/impl/common/init/CoreInitialization.java b/runtime-engine/initialization/src/main/java/me/shedaniel/rei/impl/common/init/CoreInitialization.java index c5945ead1..ff034ccf2 100644 --- a/runtime-engine/initialization/src/main/java/me/shedaniel/rei/impl/common/init/CoreInitialization.java +++ b/runtime-engine/initialization/src/main/java/me/shedaniel/rei/impl/common/init/CoreInitialization.java @@ -38,9 +38,9 @@ import me.shedaniel.rei.api.common.plugins.REIServerPlugin; import me.shedaniel.rei.api.common.registry.RecipeManagerContext; import me.shedaniel.rei.api.common.registry.ReloadStage; import me.shedaniel.rei.api.common.transfer.info.MenuInfoRegistry; -import me.shedaniel.rei.impl.common.Internals; import me.shedaniel.rei.impl.client.init.CoreClientInitialization; import me.shedaniel.rei.impl.common.InternalLogger; +import me.shedaniel.rei.impl.common.Internals; import net.minecraft.server.packs.PackType; import net.minecraft.util.Unit; import org.apache.commons.lang3.mutable.MutableLong; @@ -104,7 +104,6 @@ public class CoreInitialization { } lastReload.setValue(System.currentTimeMillis()); } - if (start == null) PluginReloaderImpl.PERFORMANCE_LOGGER.clear(); if (Platform.getEnvironment() == Env.CLIENT) { if (CoreClientInitialization.reloadPluginsClient(start)) return; } diff --git a/runtime-engine/plugins/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginReloaderImpl.java b/runtime-engine/plugins/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginReloaderImpl.java index 8078879ac..312d4e7e4 100644 --- a/runtime-engine/plugins/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginReloaderImpl.java +++ b/runtime-engine/plugins/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginReloaderImpl.java @@ -131,6 +131,10 @@ public class PluginReloaderImpl<P extends REIPlugin<?>> { } public void pre(PluginManager<P> manager, Class<P> pluginClass, List<PluginManagerImpl.PluginWrapper<P>> plugins, ReloadStage stage) { + if (stage == ReloadStage.START && manager == PluginManager.getActiveInstances().get(0)) { + PERFORMANCE_LOGGER.clear(); + } + this.forcedMainThread = false; this.forceMainThreadStopwatch.reset(); this.reloadStopwatch.reset().start(); diff --git a/runtime-engine/transfer-handlers/src/main/java/me/shedaniel/rei/impl/client/transfer/AutoCraftingEvaluatorImpl.java b/runtime-engine/transfer-handlers/src/main/java/me/shedaniel/rei/impl/client/transfer/AutoCraftingEvaluatorImpl.java new file mode 100644 index 000000000..b694eaf91 --- /dev/null +++ b/runtime-engine/transfer-handlers/src/main/java/me/shedaniel/rei/impl/client/transfer/AutoCraftingEvaluatorImpl.java @@ -0,0 +1,277 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020, 2021, 2022 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.impl.client.transfer; + +import me.shedaniel.math.Point; +import me.shedaniel.rei.api.client.REIRuntime; +import me.shedaniel.rei.api.client.config.ConfigObject; +import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.client.overlay.ScreenOverlay; +import me.shedaniel.rei.api.client.registry.transfer.TransferHandler; +import me.shedaniel.rei.api.client.registry.transfer.TransferHandlerRegistry; +import me.shedaniel.rei.api.client.registry.transfer.TransferHandlerRenderer; +import me.shedaniel.rei.api.common.display.Display; +import me.shedaniel.rei.api.common.util.CollectionUtils; +import me.shedaniel.rei.impl.client.provider.AutoCraftingEvaluator; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Locale; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +public class AutoCraftingEvaluatorImpl implements AutoCraftingEvaluator { + @Override + public Builder builder(Display display) { + return new Builder() { + private boolean actuallyCraft = false; + private boolean stacked = false; + @Nullable + private Collection<ResourceLocation> ids = display.provideInternalDisplayIds(); + private boolean buildRenderer = false; + private boolean buildTooltipRenderer = false; + + @Override + public Builder actuallyCraft() { + this.actuallyCraft = true; + return this; + } + + @Override + public Builder stacked() { + this.stacked = true; + return this; + } + + @Override + public Builder ids(@Nullable Collection<ResourceLocation> ids) { + this.ids = ids; + return this; + } + + @Override + public Builder buildRenderer() { + this.buildRenderer = true; + return this; + } + + @Override + public Builder buildTooltipRenderer() { + this.buildTooltipRenderer = true; + return this; + } + + @Override + public Result get() { + return evaluateAutoCrafting(actuallyCraft, stacked, display, buildRenderer, buildTooltipRenderer, ids); + } + }; + } + + public static class AutoCraftingResult implements AutoCraftingEvaluator.Result { + public int tint = 0; + public boolean successful = false; + public TransferHandler successfulHandler; + public boolean hasApplicable = false; + public TransferHandlerRenderer renderer; + public BiConsumer<Point, Consumer<Tooltip>> tooltipRenderer; + + @Override + public int getTint() { + return tint; + } + + @Override + public boolean isSuccessful() { + return successful; + } + + @Override + public TransferHandler getSuccessfulHandler() { + return successfulHandler; + } + + @Override + public boolean isApplicable() { + return hasApplicable; + } + + @Override + public TransferHandlerRenderer getRenderer() { + return renderer; + } + + @Override + public BiConsumer<Point, Consumer<Tooltip>> getTooltipRenderer() { + return tooltipRenderer; + } + } + + public static AutoCraftingResult evaluateAutoCrafting(boolean actuallyCrafting, boolean stackedCrafting, Display display, + boolean buildRenderer, boolean buildTooltipRenderer, + @Nullable Collection<ResourceLocation> ids) { + AbstractContainerScreen<?> containerScreen = REIRuntime.getInstance().getPreviousContainerScreen(); + AutoCraftingResult result = new AutoCraftingResult(); + final List<Tooltip.Entry> errorTooltip = new ArrayList<>(); + result.tooltipRenderer = !buildTooltipRenderer ? null : (pos, sink) -> { + List<Tooltip.Entry> str = new ArrayList<>(errorTooltip); + + if (ConfigObject.getInstance().isFavoritesEnabled()) { + str.add(Tooltip.entry(new TextComponent(" "))); + str.add(Tooltip.entry(new TranslatableComponent("text.rei.save.recipes", new TextComponent(ConfigObject.getInstance().getFavoriteKeyCode().getLocalizedName().getString().toUpperCase(Locale.ROOT)).withStyle(ChatFormatting.BOLD)).withStyle(ChatFormatting.GRAY))); + } + + if (Minecraft.getInstance().options.advancedItemTooltips && ids != null && !ids.isEmpty()) { + str.add(Tooltip.entry(new TextComponent(" "))); + for (ResourceLocation location : ids) { + String t = I18n.get("text.rei.recipe_id", "", location.toString()); + if (t.startsWith("\n")) { + t = t.substring("\n".length()); + } + str.add(Tooltip.entry(new TextComponent(t).withStyle(ChatFormatting.GRAY))); + } + } + + sink.accept(Tooltip.from(pos, str)); + }; + + if (containerScreen == null) { + errorTooltip.add(Tooltip.entry(new TranslatableComponent("error.rei.not.supported.move.items").withStyle(ChatFormatting.RED))); + return result; + } + + List<TransferHandler.Result> errors = new ArrayList<>(); + TransferHandler.Result successfulResult = null; + TransferHandler.Context context = TransferHandler.Context.create(actuallyCrafting, stackedCrafting, containerScreen, display); + + for (TransferHandler transferHandler : TransferHandlerRegistry.getInstance()) { + try { + TransferHandler.Result transferResult = transferHandler.handle(context); + + if (transferResult.isBlocking() && actuallyCrafting) { + if (transferResult.isReturningToScreen()) { + Minecraft.getInstance().setScreen(containerScreen); + REIRuntime.getInstance().getOverlay().ifPresent(ScreenOverlay::queueReloadOverlay); + } + + break; + } + + if (transferResult.isApplicable()) { + result.hasApplicable = true; + result.tint = transferResult.getColor(); + + if (buildRenderer) { + TransferHandlerRenderer transferHandlerRenderer = transferResult.getRenderer(transferHandler, context); + if (transferHandlerRenderer != null) { + result.renderer = transferHandlerRenderer; + } + } + + if (buildTooltipRenderer && transferResult.getTooltipRenderer() != null) { + BiConsumer<Point, TransferHandler.Result.TooltipSink> tooltipRenderer = transferResult.getTooltipRenderer(); + result.tooltipRenderer = (point, tooltipConsumer) -> tooltipRenderer.accept(point, tooltipConsumer::accept); + } + + if (transferResult.isSuccessful()) { + errors.clear(); + successfulResult = transferResult; + result.successful = true; + result.successfulHandler = transferHandler; + break; + } + + errors.add(transferResult); + + if (transferResult.isBlocking()) { + break; + } + } + } catch (Throwable e) { + e.printStackTrace(); + } + } + + if (!buildTooltipRenderer) return result; + + if (!result.hasApplicable) { + errorTooltip.clear(); + errorTooltip.add(Tooltip.entry(new TranslatableComponent("error.rei.not.supported.move.items").withStyle(ChatFormatting.RED))); + return result; + } + + if (errors.isEmpty()) { + errorTooltip.clear(); + errorTooltip.add(Tooltip.entry(new TranslatableComponent("text.auto_craft.move_items"))); + + if (successfulResult != null) { + successfulResult.fillTooltip(errorTooltip); + } + } else { + errorTooltip.clear(); + List<Tooltip.Entry> tooltipsFilled = new ArrayList<>(); + for (TransferHandler.Result error : errors) { + error.fillTooltip(tooltipsFilled); + } + + if (errors.size() == 1) { + for (Tooltip.Entry tooltipFilled : tooltipsFilled) { + if (tooltipFilled.isText()) { + MutableComponent colored = tooltipFilled.getAsText().copy().withStyle(ChatFormatting.RED); + if (!CollectionUtils.anyMatch(errorTooltip, ss -> ss.isText() && ss.getAsText().getString().equalsIgnoreCase(colored.getString()))) { + errorTooltip.add(Tooltip.entry(colored)); + } + } else { + errorTooltip.add(tooltipFilled); + } + } + } else { + errorTooltip.add(Tooltip.entry(new TranslatableComponent("error.rei.multi.errors").withStyle(ChatFormatting.RED))); + for (Tooltip.Entry tooltipFilled : tooltipsFilled) { + if (tooltipFilled.isText()) { + MutableComponent colored = new TextComponent("- ").withStyle(ChatFormatting.RED) + .append(tooltipFilled.getAsText().copy().withStyle(ChatFormatting.RED)); + if (!CollectionUtils.anyMatch(errorTooltip, ss -> ss.isText() && ss.getAsText().getString().equalsIgnoreCase(colored.getString()))) { + errorTooltip.add(Tooltip.entry(colored)); + } + } else { + errorTooltip.add(tooltipFilled); + } + } + } + } + + return result; + } +} diff --git a/runtime-engine/transfer-handlers/src/main/resources/META-INF/services/me.shedaniel.rei.impl.client.provider.AutoCraftingEvaluator b/runtime-engine/transfer-handlers/src/main/resources/META-INF/services/me.shedaniel.rei.impl.client.provider.AutoCraftingEvaluator new file mode 100644 index 000000000..53e00b26e --- /dev/null +++ b/runtime-engine/transfer-handlers/src/main/resources/META-INF/services/me.shedaniel.rei.impl.client.provider.AutoCraftingEvaluator @@ -0,0 +1 @@ +me.shedaniel.rei.impl.client.transfer.AutoCraftingEvaluatorImpl
\ No newline at end of file diff --git a/runtime-engine/views/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java b/runtime-engine/views/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java index 1ba0b9e4f..3483b1ee3 100644 --- a/runtime-engine/views/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java +++ b/runtime-engine/views/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java @@ -53,7 +53,8 @@ import me.shedaniel.rei.api.common.transfer.info.stack.SlotAccessor; import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryStacks; -import me.shedaniel.rei.impl.client.gui.widget.AutoCraftingEvaluator; +import me.shedaniel.rei.impl.client.ClientInternals; +import me.shedaniel.rei.impl.client.provider.AutoCraftingEvaluator; import me.shedaniel.rei.impl.client.util.CrashReportUtils; import me.shedaniel.rei.impl.client.view.craftable.CraftableFilter; import me.shedaniel.rei.impl.common.InternalLogger; @@ -319,11 +320,11 @@ public class ViewsImpl implements Views { Set<Display> applicableDisplays = new LinkedHashSet<>(); for (Display display : displays) { - AutoCraftingEvaluator.AutoCraftingResult result = AutoCraftingEvaluator.evaluateAutoCrafting(false, false, display, null); + AutoCraftingEvaluator.Result result = ClientInternals.getAutoCraftingEvaluator(display).get(); - if (result.successful) { + if (result.isSuccessful()) { successfulDisplays.add(display); - } else if (result.hasApplicable) { + } else if (result.isApplicable()) { applicableDisplays.add(display); } } @@ -451,7 +452,7 @@ public class ViewsImpl implements Views { int slotsCraftable = 0; boolean containsNonEmpty = false; List<EntryIngredient> requiredInput = display.getRequiredEntries(); - Long2LongMap invCount = new Long2LongOpenHashMap(info == null ? CraftableFilter.INSTANCE.getInvStacks() : Long2LongMaps.EMPTY_MAP); + Long2LongMap invCount = new Long2LongOpenHashMap(info == null ? CraftableFilter.getInvStacks() : Long2LongMaps.EMPTY_MAP); for (SlotAccessor inputSlot : inputSlots) { ItemStack stack = inputSlot.getItemStack(); diff --git a/runtime-engine/views/src/main/java/me/shedaniel/rei/impl/client/view/craftable/CraftableFilter.java b/runtime-engine/views/src/main/java/me/shedaniel/rei/impl/client/view/craftable/CraftableFilter.java index f004bd0ed..56be8000c 100644 --- a/runtime-engine/views/src/main/java/me/shedaniel/rei/impl/client/view/craftable/CraftableFilter.java +++ b/runtime-engine/views/src/main/java/me/shedaniel/rei/impl/client/view/craftable/CraftableFilter.java @@ -32,6 +32,8 @@ import me.shedaniel.rei.api.client.overlay.ScreenOverlay; import me.shedaniel.rei.api.common.entry.comparison.ComparisonContext; import me.shedaniel.rei.api.common.entry.type.EntryDefinition; import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; +import me.shedaniel.rei.api.common.plugins.PluginManager; +import me.shedaniel.rei.impl.client.provider.OverlayTicker; import net.minecraft.client.Minecraft; import net.minecraft.core.NonNullList; import net.minecraft.world.inventory.AbstractContainerMenu; @@ -41,12 +43,16 @@ import org.jetbrains.annotations.ApiStatus; import java.util.Op |
