diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-02-05 10:08:44 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-02-05 10:08:44 +0800 |
| commit | ea634e7ba29146d4ebc2c05b61257fa6c3b0642e (patch) | |
| tree | cd6caf4e9b77e13b21d1c890bf38604109fd93f2 /runtime/src/main/java/me/shedaniel/rei/impl | |
| parent | f5b59076cece9e95e76158b17b64fec27616b68b (diff) | |
| download | RoughlyEnoughItems-ea634e7ba29146d4ebc2c05b61257fa6c3b0642e.tar.gz RoughlyEnoughItems-ea634e7ba29146d4ebc2c05b61257fa6c3b0642e.tar.bz2 RoughlyEnoughItems-ea634e7ba29146d4ebc2c05b61257fa6c3b0642e.zip | |
More relocation
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'runtime/src/main/java/me/shedaniel/rei/impl')
34 files changed, 209 insertions, 182 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java b/runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java index 4b8d0ca83..2fb86d66a 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/AbstractEntryStack.java @@ -29,10 +29,10 @@ import it.unimi.dsi.fastutil.shorts.Short2ObjectMaps; import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.EntryStack; -import me.shedaniel.rei.api.entry.AbstractRenderer; -import me.shedaniel.rei.api.entry.ComparisonContext; -import me.shedaniel.rei.api.entry.EntryStacks; +import me.shedaniel.rei.api.ingredient.EntryStack; +import me.shedaniel.rei.api.ingredient.entry.AbstractRenderer; +import me.shedaniel.rei.api.ingredient.entry.ComparisonContext; +import me.shedaniel.rei.api.ingredient.util.EntryStacks; import me.shedaniel.rei.api.widgets.Tooltip; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/AmountIgnoredEntryStackWrapper.java b/runtime/src/main/java/me/shedaniel/rei/impl/AmountIgnoredEntryStackWrapper.java index 864c89ffd..829026318 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/AmountIgnoredEntryStackWrapper.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/AmountIgnoredEntryStackWrapper.java @@ -23,8 +23,8 @@ package me.shedaniel.rei.impl; -import me.shedaniel.rei.api.EntryStack; -import me.shedaniel.rei.api.entry.ComparisonContext; +import me.shedaniel.rei.api.ingredient.EntryStack; +import me.shedaniel.rei.api.ingredient.entry.ComparisonContext; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import org.jetbrains.annotations.ApiStatus; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java index 4cf2659e9..5d3b91900 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java @@ -29,8 +29,10 @@ import me.shedaniel.architectury.utils.Fraction; import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.RoughlyEnoughItemsNetwork; import me.shedaniel.rei.api.*; -import me.shedaniel.rei.api.entry.EntryStacks; -import me.shedaniel.rei.api.entry.VanillaEntryTypes; +import me.shedaniel.rei.api.ingredient.EntryStack; +import me.shedaniel.rei.api.ingredient.util.EntryStacks; +import me.shedaniel.rei.api.ingredient.entry.VanillaEntryTypes; +import me.shedaniel.rei.api.registry.category.DisplayCategory; import me.shedaniel.rei.gui.PreRecipeViewingScreen; import me.shedaniel.rei.gui.RecipeScreen; import me.shedaniel.rei.gui.RecipeViewingScreen; @@ -187,13 +189,13 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer { } @ApiStatus.Internal - public void openRecipeViewingScreen(Map<RecipeCategory<?>, List<RecipeDisplay>> map, @Nullable ResourceLocation category, @Nullable EntryStack<?> ingredientNotice, @Nullable EntryStack<?> resultNotice) { + public void openRecipeViewingScreen(Map<DisplayCategory<?>, List<Display>> map, @Nullable ResourceLocation category, @Nullable EntryStack<?> ingredientNotice, @Nullable EntryStack<?> resultNotice) { openView(new LegacyWrapperViewSearchBuilder(map).setPreferredOpenedCategory(category).setInputNotice(ingredientNotice).setOutputNotice(resultNotice).fillPreferredOpenedCategory()); } @Override public boolean openView(ClientHelper.ViewSearchBuilder builder) { - Map<RecipeCategory<?>, List<RecipeDisplay>> map = builder.buildMap(); + Map<DisplayCategory<?>, List<Display>> map = builder.buildMap(); if (map.isEmpty()) return false; Screen screen; if (ConfigObject.getInstance().getRecipeScreenType() == RecipeScreenType.VILLAGER) { @@ -255,7 +257,7 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer { @Nullable private EntryStack<?> inputNotice; @Nullable private EntryStack<?> outputNotice; @NotNull - private final LazyLoadedValue<Map<RecipeCategory<?>, List<RecipeDisplay>>> map = new LazyLoadedValue<>(() -> RecipeHelper.getInstance().buildMapFor(this)); + private final LazyLoadedValue<Map<DisplayCategory<?>, List<Display>>> map = new LazyLoadedValue<>(() -> RecipeRegistry.getInstance().buildMapFor(this)); @Override public ClientHelper.ViewSearchBuilder addCategory(ResourceLocation category) { @@ -337,18 +339,18 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer { @NotNull @Override - public Map<RecipeCategory<?>, List<RecipeDisplay>> buildMap() { + public Map<DisplayCategory<?>, List<Display>> buildMap() { return this.map.get(); } } public static final class LegacyWrapperViewSearchBuilder extends AbstractViewSearchBuilder { - @NotNull private final Map<RecipeCategory<?>, List<RecipeDisplay>> map; + @NotNull private final Map<DisplayCategory<?>, List<Display>> map; @Nullable private ResourceLocation preferredOpenedCategory = null; @Nullable private EntryStack<?> inputNotice; @Nullable private EntryStack<?> outputNotice; - public LegacyWrapperViewSearchBuilder(@NotNull Map<RecipeCategory<?>, List<RecipeDisplay>> map) { + public LegacyWrapperViewSearchBuilder(@NotNull Map<DisplayCategory<?>, List<Display>> map) { this.map = map; } @@ -424,7 +426,7 @@ public class ClientHelperImpl implements ClientHelper, ClientModInitializer { } @Override - public @NotNull Map<RecipeCategory<?>, List<RecipeDisplay>> buildMap() { + public @NotNull Map<DisplayCategory<?>, List<Display>> buildMap() { return this.map; } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java index 20761c828..ce9372fd7 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/ConfigManagerImpl.java @@ -50,7 +50,7 @@ import me.shedaniel.clothconfig2.impl.EasingMethod; import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.api.ConfigManager; import me.shedaniel.rei.api.EntryRegistry; -import me.shedaniel.rei.api.EntryStack; +import me.shedaniel.rei.api.ingredient.EntryStack; import me.shedaniel.rei.api.REIHelper; import me.shedaniel.rei.api.favorites.FavoriteEntry; import me.shedaniel.rei.gui.ContainerScreenOverlay; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java index aee2abfe4..5765f81eb 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/ConfigObjectImpl.java @@ -31,7 +31,7 @@ import me.sargunvohra.mcmods.autoconfig1u.shadowed.blue.endless.jankson.Comment; import me.shedaniel.clothconfig2.api.Modifier; import me.shedaniel.clothconfig2.api.ModifierKeyCode; import me.shedaniel.rei.api.ConfigObject; -import me.shedaniel.rei.api.EntryStack; +import me.shedaniel.rei.api.ingredient.EntryStack; import me.shedaniel.rei.api.favorites.FavoriteEntry; import me.shedaniel.rei.gui.config.*; import me.shedaniel.rei.impl.filtering.FilteringRule; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/DisplayHelperImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/DisplayBoundsRegistryImpl.java index 2c6ef4cb1..05d8bc98b 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/DisplayHelperImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/DisplayBoundsRegistryImpl.java @@ -27,8 +27,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.mojang.blaze3d.platform.Window; import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.BaseBoundsHandler; -import me.shedaniel.rei.api.DisplayHelper; +import me.shedaniel.rei.api.ExclusionZones; +import me.shedaniel.rei.api.DisplayBoundsRegistry; import me.shedaniel.rei.api.OverlayDecider; import me.shedaniel.rei.gui.config.DisplayPanelLocation; import me.shedaniel.rei.utils.CollectionUtils; @@ -44,12 +44,12 @@ import java.util.Map; @ApiStatus.Internal @Environment(EnvType.CLIENT) -public class DisplayHelperImpl implements DisplayHelper { +public class DisplayBoundsRegistryImpl implements DisplayBoundsRegistry { private static final Comparator<OverlayDecider> BOUNDS_HANDLER_COMPARATOR = Comparator.comparingDouble(OverlayDecider::getPriority).reversed(); private List<OverlayDecider> screenDisplayBoundsHandlers = Lists.newArrayList(); private Map<Class<?>, List<OverlayDecider>> deciderSortedCache = Maps.newHashMap(); - private BaseBoundsHandler baseBoundsHandler; + private ExclusionZones exclusionZones; private Class<?> tempScreen; @Override @@ -97,15 +97,14 @@ public class DisplayHelperImpl implements DisplayHelper { screenDisplayBoundsHandlers.sort(BOUNDS_HANDLER_COMPARATOR); } - @ApiStatus.Internal @Override - public BaseBoundsHandler getBaseBoundsHandler() { - return baseBoundsHandler; + public ExclusionZones exclusionZones() { + return exclusionZones; } @ApiStatus.Internal - public void setBaseBoundsHandler(BaseBoundsHandler baseBoundsHandler) { - this.baseBoundsHandler = baseBoundsHandler; + public void setExclusionZones(ExclusionZones exclusionZones) { + this.exclusionZones = exclusionZones; } @ApiStatus.Internal diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java index ad5f46c17..a9a5aa386 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/EntryRegistryImpl.java @@ -28,8 +28,8 @@ import com.google.common.collect.Lists; import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.api.ConfigObject; import me.shedaniel.rei.api.EntryRegistry; -import me.shedaniel.rei.api.EntryStack; -import me.shedaniel.rei.api.entry.EntryStacks; +import me.shedaniel.rei.api.ingredient.EntryStack; +import me.shedaniel.rei.api.ingredient.util.EntryStacks; import me.shedaniel.rei.impl.filtering.FilteringContextImpl; import me.shedaniel.rei.impl.filtering.FilteringContextType; import me.shedaniel.rei.impl.filtering.FilteringRule; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeDeferred.java b/runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeDeferred.java index 8a9153bf3..ac9724734 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeDeferred.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeDeferred.java @@ -23,15 +23,14 @@ package me.shedaniel.rei.impl; -import me.shedaniel.rei.api.entry.EntryDefinition; -import me.shedaniel.rei.api.entry.EntryType; -import me.shedaniel.rei.api.entry.EntryTypeRegistry; +import me.shedaniel.rei.api.ingredient.entry.EntryDefinition; +import me.shedaniel.rei.api.ingredient.entry.EntryType; +import me.shedaniel.rei.api.ingredient.entry.EntryTypeRegistry; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import java.lang.ref.WeakReference; -import java.util.concurrent.atomic.AtomicReference; @ApiStatus.Internal public class EntryTypeDeferred<T> implements EntryType<T> { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeRegistryImpl.java index c7dec1540..4003cf4a5 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeRegistryImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/EntryTypeRegistryImpl.java @@ -27,10 +27,10 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBasedTable; import com.google.common.collect.HashBiMap; import com.google.common.collect.Table; -import me.shedaniel.rei.api.entry.EntryDefinition; -import me.shedaniel.rei.api.entry.EntryType; -import me.shedaniel.rei.api.entry.EntryTypeBridge; -import me.shedaniel.rei.api.entry.EntryTypeRegistry; +import me.shedaniel.rei.api.ingredient.entry.EntryDefinition; +import me.shedaniel.rei.api.ingredient.entry.EntryType; +import me.shedaniel.rei.api.ingredient.entry.EntryTypeBridge; +import me.shedaniel.rei.api.ingredient.entry.EntryTypeRegistry; import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/BaseBoundsHandlerImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/ExclusionZonesImpl.java index 56f0d8a6a..6954b66ad 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/BaseBoundsHandlerImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/ExclusionZonesImpl.java @@ -25,8 +25,8 @@ package me.shedaniel.rei.impl; import com.google.common.collect.Lists; import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.BaseBoundsHandler; -import me.shedaniel.rei.api.DisplayHelper; +import me.shedaniel.rei.api.ExclusionZones; +import me.shedaniel.rei.api.DisplayBoundsRegistry; import me.shedaniel.rei.gui.config.DisplayPanelLocation; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -42,7 +42,7 @@ import java.util.function.Supplier; @ApiStatus.Internal @Environment(EnvType.CLIENT) -public class BaseBoundsHandlerImpl implements BaseBoundsHandler { +public class ExclusionZonesImpl implements ExclusionZones { private static final Comparator<? super Rectangle> RECTANGLE_COMPARER = Comparator.comparingLong(Rectangle::hashCode); @@ -81,7 +81,7 @@ public class BaseBoundsHandlerImpl implements BaseBoundsHandler { } private long currentHashCode(DisplayPanelLocation location) { - return areasHashCode(DisplayHelper.getInstance().getOverlayBounds(location, Minecraft.getInstance().screen), getExclusionZones(Minecraft.getInstance().screen.getClass(), false)); + return areasHashCode(DisplayBoundsRegistry.getInstance().getOverlayBounds(location, Minecraft.getInstance().screen), getExclusionZones(Minecraft.getInstance().screen.getClass(), false)); } @Override @@ -97,12 +97,12 @@ public class BaseBoundsHandlerImpl implements BaseBoundsHandler { } @Override - public int supplierSize() { + public int getZonesCount() { return list.size(); } @Override - public void registerExclusionZones(Class<?> screenClass, Supplier<List<Rectangle>> supplier) { + public void register(Class<?> screenClass, Supplier<List<Rectangle>> supplier) { list.add(new Tuple<>(new Tuple<>(screenClass, 0f), supplier)); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/FluidSupportProviderImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/FluidSupportProviderImpl.java index 6870c06d3..15b87f127 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/FluidSupportProviderImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/FluidSupportProviderImpl.java @@ -25,7 +25,7 @@ package me.shedaniel.rei.impl; import com.google.common.collect.Lists; import me.shedaniel.architectury.fluid.FluidStack; -import me.shedaniel.rei.api.EntryStack; +import me.shedaniel.rei.api.ingredient.EntryStack; import me.shedaniel.rei.api.fluid.FluidSupportProvider; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/InternalWidgets.java b/runtime/src/main/java/me/shedaniel/rei/impl/InternalWidgets.java index 9256367e0..1f241c0fb 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/InternalWidgets.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/InternalWidgets.java @@ -29,6 +29,7 @@ import it.unimi.dsi.fastutil.ints.IntList; import me.shedaniel.math.Rectangle; import me.shedaniel.math.impl.PointHelper; import me.shedaniel.rei.api.*; +import me.shedaniel.rei.api.registry.category.DisplayCategory; import me.shedaniel.rei.api.widgets.Button; import me.shedaniel.rei.api.widgets.Widgets; import me.shedaniel.rei.gui.toast.CopyRecipeIdentifierToast; @@ -57,7 +58,7 @@ import java.util.function.Supplier; public final class InternalWidgets { private InternalWidgets() {} - public static Widget createAutoCraftingButtonWidget(Rectangle displayBounds, Rectangle rectangle, Component text, Supplier<RecipeDisplay> displaySupplier, List<Widget> setupDisplay, RecipeCategory<?> category) { + public static Widget createAutoCraftingButtonWidget(Rectangle displayBounds, Rectangle rectangle, Component text, Supplier<Display> displaySupplier, List<Widget> setupDisplay, DisplayCategory<?> category) { AbstractContainerScreen<?> containerScreen = REIHelper.getInstance().getPreviousContainerScreen(); boolean[] visible = {false}; List<String>[] errorTooltip = new List[]{null}; @@ -65,7 +66,7 @@ public final class InternalWidgets { .focusable(false) .onClick(button -> { AutoTransferHandler.Context context = AutoTransferHandler.Context.create(true, containerScreen, displaySupplier.get()); - for (AutoTransferHandler autoTransferHandler : RecipeHelper.getInstance().getSortedAutoCraftingHandler()) + for (AutoTransferHandler autoTransferHandler : RecipeRegistry.getInstance().getSortedAutoCraftingHandler()) try { AutoTransferHandler.Result result = autoTransferHandler.handle(context); if (result.isBlocking()) { @@ -87,7 +88,7 @@ public final class InternalWidgets { visible[0] = false; IntList redSlots = null; AutoTransferHandler.Context context = AutoTransferHandler.Context.create(false, containerScreen, displaySupplier.get()); - for (AutoTransferHandler autoTransferHandler : RecipeHelper.getInstance().getSortedAutoCraftingHandler()) { + for (AutoTransferHandler autoTransferHandler : RecipeRegistry.getInstance().getSortedAutoCraftingHandler()) { try { AutoTransferHandler.Result result = autoTransferHandler.handle(context); if (result.isApplicable()) @@ -121,8 +122,8 @@ public final class InternalWidgets { } error.add("error.rei.no.handlers.applicable"); } - if ((button.containsMouse(PointHelper.ofMouse()) || button.isFocused()) && category instanceof TransferRecipeCategory && redSlots != null) { - ((TransferRecipeCategory<RecipeDisplay>) category).renderRedSlots(matrices, setupDisplay, displayBounds, displaySupplier.get(), redSlots); + if ((button.containsMouse(PointHelper.ofMouse()) || button.isFocused()) && category instanceof TransferDisplayCategory && redSlots != null) { + ((TransferDisplayCategory<Display>) category).renderRedSlots(matrices, setupDisplay, displayBounds, displaySupplier.get(), redSlots); } errorTooltip[0] = error == null || error.isEmpty() ? null : Lists.newArrayList(); if (errorTooltip[0] != null) { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/RecipeRegistryImpl.java index d48fcec02..e983bc535 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/RecipeRegistryImpl.java @@ -28,9 +28,12 @@ import com.google.common.collect.*; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.RoughlyEnoughItemsCore; import me.shedaniel.rei.api.*; -import me.shedaniel.rei.api.entry.EntryStacks; import me.shedaniel.rei.api.fluid.FluidSupportProvider; +import me.shedaniel.rei.api.ingredient.EntryIngredient; +import me.shedaniel.rei.api.ingredient.EntryStack; +import me.shedaniel.rei.api.ingredient.util.EntryStacks; import me.shedaniel.rei.api.plugins.REIPluginV0; +import me.shedaniel.rei.api.registry.category.DisplayCategory; import me.shedaniel.rei.api.subsets.SubsetsRegistry; import me.shedaniel.rei.impl.subsets.SubsetsRegistryImpl; import me.shedaniel.rei.utils.CollectionUtils; @@ -44,6 +47,7 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeManager; +import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.tuple.MutablePair; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -58,10 +62,7 @@ import java.util.stream.Stream; @ApiStatus.Internal @Environment(EnvType.CLIENT) -public class RecipeHelperImpl implements RecipeHelper { - - private static final Comparator<FocusedStackProvider> FOCUSED_STACK_PROVIDER_COMPARATOR = Comparator.comparingDouble(FocusedStackProvider::getPriority).reversed(); - private static final Comparator<DisplayVisibilityHandler> VISIBILITY_HANDLER_COMPARATOR = Comparator.comparingDouble(DisplayVisibilityHandler::getPriority).reversed(); +public class RecipeRegistryImpl implements RecipeRegistry { @SuppressWarnings("rawtypes") private static final Comparator<Recipe> RECIPE_COMPARATOR = Comparator.comparing((Recipe o) -> o.getId().getNamespace()).thenComparing(o -> o.getId().getPath()); @@ -69,24 +70,24 @@ public class RecipeHelperImpl implements RecipeHelper { private final List<AutoTransferHandler> autoTransferHandlers = Lists.newArrayList(); private final List<RecipeFunction<?>> recipeFunctions = Lists.newArrayList(); private final Multimap<Class<? extends Screen>, ClickAreaHandler<?>> screenClickAreas = HashMultimap.create(); - private final int[] recipeCount = {0}; - private final Map<ResourceLocation, List<RecipeDisplay>> recipeDisplays = Maps.newHashMap(); - private final BiMap<RecipeCategory<?>, ResourceLocation> categories = HashBiMap.create(); + private final MutableInt recipeCount = new MutableInt(0); + private final Map<ResourceLocation, List<Display>> recipeDisplays = Maps.newHashMap(); + private final BiMap<DisplayCategory<?>, ResourceLocation> categories = HashBiMap.create(); private final Map<ResourceLocation, ButtonAreaSupplier> autoCraftAreaSupplierMap = Maps.newHashMap(); private final Map<ResourceLocation, List<List<? extends EntryStack<?>>>> categoryWorkingStations = Maps.newHashMap(); private final List<DisplayVisibilityHandler> displayVisibilityHandlers = Lists.newArrayList(); - private final List<LiveRecipeGenerator<RecipeDisplay>> liveRecipeGenerators = Lists.newArrayList(); + private final List<LiveRecipeGenerator<Display>> liveRecipeGenerators = Lists.newArrayList(); private RecipeManager recipeManager; private boolean arePluginsLoading = false; @Override public List<EntryStack<?>> findCraftableEntriesByItems(Iterable<? extends EntryStack<?>> inventoryItems) { List<EntryStack<?>> craftables = new ArrayList<>(); - for (List<RecipeDisplay> value : recipeDisplays.values()) - for (RecipeDisplay recipeDisplay : Lists.newArrayList(value)) { + for (List<Display> value : recipeDisplays.values()) + for (Display display : Lists.newArrayList(value)) { int slotsCraftable = 0; - List |
