diff options
| author | shedaniel <daniel@shedaniel.me> | 2023-10-23 21:54:28 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2023-10-23 21:54:28 +0800 |
| commit | 120e6ea190a342e367e7c26b77d22b057091af84 (patch) | |
| tree | b214b8cf1d24b06ea32e925824af0ea4b7ea7954 | |
| parent | 67d12db3f28127232ffe8e02957076f210c5cc92 (diff) | |
| parent | 11278f48effaa9a7ccc212ce0a047e356d9c4859 (diff) | |
| download | RoughlyEnoughItems-120e6ea190a342e367e7c26b77d22b057091af84.tar.gz RoughlyEnoughItems-120e6ea190a342e367e7c26b77d22b057091af84.tar.bz2 RoughlyEnoughItems-120e6ea190a342e367e7c26b77d22b057091af84.zip | |
Merge remote-tracking branch 'origin/11.x-1.19.4' into 12.x-1.20
# Conflicts:
# runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java
# runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java
# runtime/src/main/java/me/shedaniel/rei/impl/client/registry/screen/DefaultScreenOverlayRenderer.java
19 files changed, 184 insertions, 88 deletions
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/DefaultCraftingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/DefaultCraftingCategory.java index 963717e45..3f91ad76b 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/DefaultCraftingCategory.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/crafting/DefaultCraftingCategory.java @@ -95,7 +95,7 @@ public class DefaultCraftingCategory implements DisplayCategory<DefaultCraftingD @Override public boolean canMerge(DefaultCraftingDisplay<?> first, DefaultCraftingDisplay<?> second) { if (!first.getCategoryIdentifier().equals(second.getCategoryIdentifier())) return false; - if (!equals(first.getOrganisedInputEntries(3, 3), second.getInputEntries())) return false; + if (!equals(first.getOrganisedInputEntries(3, 3), second.getOrganisedInputEntries(3, 3))) return false; if (!equals(first.getOutputEntries(), second.getOutputEntries())) return false; if (first.isShapeless() != second.isShapeless()) return false; if (first.getWidth() != second.getWidth()) return false; diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java index 6ea420004..de49c9a29 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java @@ -479,6 +479,7 @@ public class RoughlyEnoughItemsCoreClient { } lastReload.setValue(System.currentTimeMillis()); } + InternalLogger.getInstance().debug("Starting Reload Plugins of stage " + start, new Throwable()); if (ConfigObject.getInstance().doesRegisterRecipesInAnotherThread()) { Future<?>[] futures = new Future<?>[1]; CompletableFuture<Void> future = CompletableFuture.runAsync(() -> RoughlyEnoughItemsCore._reloadPlugins(start), RELOAD_PLUGINS) diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java index b10232ac5..5288a91d7 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringScreen.java @@ -252,7 +252,7 @@ public class FilteringScreen extends Screen { scrolling.renderScrollBar(graphics, 0, 1.0F, REIRuntime.getInstance().isDarkThemeEnabled() ? 0.8F : 1F); graphics.pose().pushPose(); graphics.pose().translate(0, 0, 300); - this.searchField.laterRender(graphics, mouseX, mouseY, delta); + this.searchField.render(graphics, mouseX, mouseY, delta); this.selectAllButton.render(graphics, mouseX, mouseY, delta); this.selectNoneButton.render(graphics, mouseX, mouseY, delta); this.hideButton.render(graphics, mouseX, mouseY, delta); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java index 5c7a3375b..6d2bc995e 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java @@ -57,7 +57,7 @@ public class ReloadPluginsEntry extends AbstractConfigListEntry<Unit> { public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { if (PluginManager.areAnyReloading()) { Screen screen = Minecraft.getInstance().screen; - Minecraft.getInstance().setScreen(new ConfigReloadingScreen(Component.translatable("text.rei.config.is.reloading"), PluginManager::areAnyReloading, () -> Minecraft.getInstance().setScreen(screen))); + Minecraft.getInstance().setScreen(new ConfigReloadingScreen(Component.translatable("text.rei.config.is.reloading"), PluginManager::areAnyReloading, () -> Minecraft.getInstance().setScreen(screen), null)); } else { super.render(graphics, mouseX, mouseY, delta); } @@ -88,7 +88,7 @@ public class ReloadPluginsEntry extends AbstractConfigListEntry<Unit> { @Override public void save() { - + } @Override diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java index 12f32428b..2dbf02432 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/ConfigReloadingScreen.java @@ -25,7 +25,9 @@ package me.shedaniel.rei.impl.client.gui.screen; import net.minecraft.Util; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; @@ -39,12 +41,14 @@ public class ConfigReloadingScreen extends Screen { private final BooleanSupplier predicate; private Supplier<@Nullable Component> subtitle = () -> null; private final Runnable parent; + private final Runnable cancel; - public ConfigReloadingScreen(Component title, BooleanSupplier predicate, Runnable parent) { + public ConfigReloadingScreen(Component title, BooleanSupplier predicate, Runnable parent, Runnable cancel) { super(Component.empty()); this.title = title; this.predicate = predicate; this.parent = parent; + this.cancel = cancel; } public void setSubtitle(Supplier<@Nullable Component> subtitle) { @@ -57,6 +61,15 @@ public class ConfigReloadingScreen extends Screen { } @Override + public void init() { + super.init(); + if (cancel == null) return; + this.addRenderableWidget(Button.builder(CommonComponents.GUI_CANCEL, button -> { + cancel.run(); + }).bounds(this.width / 2 - 100, this.height / 4 + 120 + 12, 200, 20).build()); + } + + @Override public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) { this.renderDirtBackground(graphics); if (!predicate.getAsBoolean()) { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CraftableFilterButtonWidget.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CraftableFilterButtonWidget.java index ccfc498c6..e5742ed98 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CraftableFilterButtonWidget.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/CraftableFilterButtonWidget.java @@ -23,6 +23,7 @@ package me.shedaniel.rei.impl.client.gui.widget; +import dev.architectury.platform.Platform; import dev.architectury.utils.value.BooleanValue; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; @@ -148,15 +149,22 @@ public class CraftableFilterButtonWidget { ConfigReloadingScreen reloadingScreen = new ConfigReloadingScreen(Component.translatable("text.rei.input.methods.initializing"), () -> !future.isDone(), () -> { Minecraft.getInstance().setScreen(screen); + }, () -> { + Minecraft.getInstance().setScreen(screen); + InternalLogger.getInstance().error("Failed to prepare input method: cancelled"); + ConfigManagerImpl.getInstance().getConfig().setInputMethodId(new ResourceLocation("rei:default")); + future.cancel(Platform.isFabric()); + service.shutdown(); }); reloadingScreen.setSubtitle(() -> Component.translatable("text.rei.input.methods.reload.progress", String.format("%.2f", progress[0] * 100))); Minecraft.getInstance().setScreen(reloadingScreen); access.close(); future.whenComplete((unused, throwable) -> { service.shutdown(); + if (throwable != null) return; + ScreenOverlayImpl.getInstance().getHintsContainer().addHint(12, () -> new Point(getCraftableFilterBounds().getCenterX(), getCraftableFilterBounds().getCenterY()), + "text.rei.hint.input.methods", List.of(Component.translatable("text.rei.hint.input.methods"))); }); - ScreenOverlayImpl.getInstance().getHintsContainer().addHint(12, () -> new Point(getCraftableFilterBounds().getCenterX(), getCraftableFilterBounds().getCenterY()), - "text.rei.hint.input.methods", List.of(Component.translatable("text.rei.hint.input.methods"))); }) .withActive(() -> !Objects.equals(config.getInputMethodId(), pair.getKey())) .withTooltip(() -> Tooltip.create(Widget.mouse(), pair.getValue().getDescription())) diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/screen/DefaultScreenOverlayRenderer.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/screen/DefaultScreenOverlayRenderer.java index 233e1e421..308dc7409 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/screen/DefaultScreenOverlayRenderer.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/registry/screen/DefaultScreenOverlayRenderer.java @@ -31,9 +31,7 @@ import me.shedaniel.rei.api.client.gui.screen.DisplayScreen; import me.shedaniel.rei.api.client.registry.screen.OverlayRendererProvider; import me.shedaniel.rei.impl.common.InternalLogger; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; - -import java.util.ArrayList; -import java.util.List; +import org.jetbrains.annotations.Nullable; import static me.shedaniel.rei.RoughlyEnoughItemsCoreClient.resetFocused; import static me.shedaniel.rei.RoughlyEnoughItemsCoreClient.shouldReturn; @@ -41,22 +39,50 @@ import static me.shedaniel.rei.RoughlyEnoughItemsCoreClient.shouldReturn; public enum DefaultScreenOverlayRenderer implements OverlayRendererProvider { INSTANCE; - private final List<Runnable> onRemoved = new ArrayList<>(); + @Nullable + private ClientGuiEvent.ScreenRenderPre renderPre; + @Nullable + private ClientGuiEvent.ContainerScreenRenderBackground renderContainerBg; + @Nullable + private ClientGuiEvent.ContainerScreenRenderForeground renderContainerFg; + @Nullable + private ClientGuiEvent.ScreenRenderPost renderPost; + + { + ClientGuiEvent.RENDER_PRE.register((screen, graphics, mouseX, mouseY, delta) -> { + if (renderPre != null) { + return renderPre.render(screen, graphics, mouseX, mouseY, delta); + } else { + return EventResult.pass(); + } + }); + ClientGuiEvent.RENDER_CONTAINER_BACKGROUND.register((screen, graphics, mouseX, mouseY, delta) -> { + if (renderContainerBg != null) { + renderContainerBg.render(screen, graphics, mouseX, mouseY, delta); + } + }); + ClientGuiEvent.RENDER_CONTAINER_FOREGROUND.register((screen, graphics, mouseX, mouseY, delta) -> { + if (renderContainerFg != null) { + renderContainerFg.render(screen, graphics, mouseX, mouseY, delta); + } + }); + ClientGuiEvent.RENDER_POST.register((screen, graphics, mouseX, mouseY, delta) -> { + if (renderPost != null) { + renderPost.render(screen, graphics, mouseX, mouseY, delta); + } + }); + } @Override public void onApplied(Sink sink) { int[] rendered = {0}; - ClientGuiEvent.ScreenRenderPre renderPre; - ClientGuiEvent.ContainerScreenRenderBackground renderContainerBg; - ClientGuiEvent.ContainerScreenRenderForeground renderContainerFg; - ClientGuiEvent.ScreenRenderPost renderPost; - ClientGuiEvent.RENDER_PRE.register(renderPre = (screen, graphics, mouseX, mouseY, delta) -> { + this.renderPre = (screen, graphics, mouseX, mouseY, delta) -> { if (shouldReturn(screen)) return EventResult.pass(); rendered[0] = 0; return EventResult.pass(); - }); - ClientGuiEvent.RENDER_CONTAINER_BACKGROUND.register(renderContainerBg = (screen, graphics, mouseX, mouseY, delta) -> { + }; + this.renderContainerBg = (screen, graphics, mouseX, mouseY, delta) -> { if (shouldReturn(screen)) return; rendered[0] = 1; @@ -65,8 +91,8 @@ public enum DefaultScreenOverlayRenderer implements OverlayRendererProvider { sink.render(graphics, mouseX, mouseY, delta); } resetFocused(screen); - }); - ClientGuiEvent.RENDER_CONTAINER_FOREGROUND.register(renderContainerFg = (screen, graphics, mouseX, mouseY, delta) -> { + }; + this.renderContainerFg = (screen, graphics, mouseX, mouseY, delta) -> { if (shouldReturn(screen)) return; rendered[0] = 2; @@ -76,8 +102,8 @@ public enum DefaultScreenOverlayRenderer implements OverlayRendererProvider { sink.lateRender(graphics, mouseX, mouseY, delta); graphics.pose().popPose(); resetFocused(screen); - }); - ClientGuiEvent.RENDER_POST.register(renderPost = (screen, graphics, mouseX, mouseY, delta) -> { + }; + this.renderPost = (screen, graphics, mouseX, mouseY, delta) -> { if (shouldReturn(screen) || rendered[0] == 2) return; if (screen instanceof AbstractContainerScreen) { @@ -92,18 +118,14 @@ public enum DefaultScreenOverlayRenderer implements OverlayRendererProvider { sink.lateRender(graphics, mouseX, mouseY, delta); } resetFocused(screen); - }); - this.onRemoved.add(() -> { - ClientGuiEvent.RENDER_PRE.unregister(renderPre); - ClientGuiEvent.RENDER_CONTAINER_BACKGROUND.unregister(renderContainerBg); - ClientGuiEvent.RENDER_CONTAINER_FOREGROUND.unregister(renderContainerFg); - ClientGuiEvent.RENDER_POST.unregister(renderPost); - }); + }; } @Override public void onRemoved() { - this.onRemoved.forEach(Runnable::run); - this.onRemoved.clear(); + this.renderPre = null; + this.renderContainerBg = null; + this.renderContainerFg = null; + this.renderPost = null; } } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/AsyncSearchManager.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/AsyncSearchManager.java index c1ab15fba..8d1f6f056 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/AsyncSearchManager.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/AsyncSearchManager.java @@ -48,14 +48,14 @@ import java.util.function.UnaryOperator; public class AsyncSearchManager { private static final ExecutorService EXECUTOR_SERVICE = new ThreadCreator("REI-AsyncSearchManager").asService(Math.min(3, Runtime.getRuntime().availableProcessors())); - private final Supplier<List<HashedEntryStackWrapper>> stacksProvider; + private final Supplier<List<? extends HashedEntryStackWrapper>> stacksProvider; private final Supplier<Predicate<HashedEntryStackWrapper>> additionalPredicateSupplier; private final UnaryOperator<HashedEntryStackWrapper> transformer; private volatile Map.Entry<List<HashedEntryStackWrapper>, SearchFilter> last; public volatile ExecutorTuple executor; public volatile SearchFilter filter; - public AsyncSearchManager(Supplier<List<HashedEntryStackWrapper>> stacksProvider, Supplier<Predicate<HashedEntryStackWrapper>> additionalPredicateSupplier, UnaryOperator<HashedEntryStackWrapper> transformer) { + public AsyncSearchManager(Supplier<List<? extends HashedEntryStackWrapper>> stacksProvider, Supplier<Predicate<HashedEntryStackWrapper>> additionalPredicateSupplier, UnaryOperator<HashedEntryStackWrapper> transformer) { this.stacksProvider = stacksProvider; this.additionalPredicateSupplier = additionalPredicateSupplier; this.transformer = transformer; @@ -134,7 +134,7 @@ public class AsyncSearchManager { } public static CompletableFuture<Map.Entry<List<HashedEntryStackWrapper>, SearchFilter>> get(SearchFilter filter, Predicate<HashedEntryStackWrapper> additionalPredicate, - UnaryOperator<HashedEntryStackWrapper> transformer, List<HashedEntryStackWrapper> stacks, Map.Entry<List<HashedEntryStackWrapper>, SearchFilter> last, + UnaryOperator<HashedEntryStackWrapper> transformer, List<? extends HashedEntryStackWrapper> stacks, Map.Entry<List<HashedEntryStackWrapper>, SearchFilter> last, AsyncSearchManager manager, Executor executor, Steps steps) { int searchPartitionSize = ConfigObject.getInstance().getAsyncSearchPartitionSize(); boolean shouldAsync = ConfigObject.getInstance().shouldAsyncSearch() && stacks.size() > searchPartitionSize * 4; @@ -144,7 +144,7 @@ public class AsyncSearchManager { if (shouldAsync) { List<CompletableFuture<List<HashedEntryStackWrapper>>> futures = Lists.newArrayList(); int partitions = 0; - for (Iterable<HashedEntryStackWrapper> partitionStacks : CollectionUtils.partition(stacks, searchPartitionSize * 4)) { + for (Iterable<? extends HashedEntryStackWrapper> partitionStacks : CollectionUtils.partition(stacks, searchPartitionSize * 4)) { final int finalPartitions = partitions; futures.add(CompletableFuture.supplyAsync(() -> { List<HashedEntryStackWrapper> filtered = Lists.newArrayList(); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/Argument.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/Argument.java index bd5034aa3..e0b7fd737 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/Argument.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/Argument.java @@ -24,7 +24,6 @@ package me.shedaniel.rei.impl.client.search.argument; import com.google.common.base.MoreObjects; -import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; @@ -33,12 +32,14 @@ import me.shedaniel.rei.api.client.registry.entry.EntryRegistry; import me.shedaniel.rei.api.client.search.method.CharacterUnpackingInputMethod; import me.shedaniel.rei.api.client.search.method.InputMethod; import me.shedaniel.rei.api.common.entry.EntryStack; +import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.impl.client.search.IntRange; import me.shedaniel.rei.impl.client.search.argument.type.ArgumentType; import me.shedaniel.rei.impl.client.search.argument.type.ArgumentTypesRegistry; import me.shedaniel.rei.impl.client.search.collapsed.CollapsedEntriesCache; import me.shedaniel.rei.impl.client.search.result.ArgumentApplicableResult; import me.shedaniel.rei.impl.common.entry.type.EntryRegistryImpl; +import me.shedaniel.rei.impl.common.util.HNEntryStackWrapper; import me.shedaniel.rei.impl.common.util.HashedEntryStackWrapper; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -78,18 +79,8 @@ public class Argument<T, R> { public static void resetCache(boolean cache) { Argument.cache = new ArgumentCache(); CollapsedEntriesCache.reset(); - Collection<HashedEntryStackWrapper> stacks = new AbstractCollection<>() { - @Override - public Iterator<HashedEntryStackWrapper> iterator() { - return Iterators.transform(((EntryRegistryImpl) EntryRegistry.getInstance()).getComplexList().iterator(), - HashedEntryStackWrapper::normalize); - } - - @Override - public int size() { - return ((EntryRegistryImpl) EntryRegistry.getInstance()).getComplexList().size(); - } - }; + List<HashedEntryStackWrapper> stacks = CollectionUtils.map(((EntryRegistryImpl) EntryRegistry.getInstance()).getComplexList(), + HNEntryStackWrapper::normalize); if (cache) { Argument.cache.prepareFilter(stacks, ArgumentTypesRegistry.ARGUMENT_TYPE_LIST, ArgumentCache.EXECUTOR_SERVICE); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/collapsed/CollapsedEntriesCache.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/collapsed/CollapsedEntriesCache.java index fc7ada4e8..2f87b2295 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/collapsed/CollapsedEntriesCache.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/collapsed/CollapsedEntriesCache.java @@ -51,7 +51,7 @@ public class CollapsedEntriesCache { return instance; } - public void prepare(Collection<HashedEntryStackWrapper> stacks) { + public void prepare(Collection<? extends HashedEntryStackWrapper> stacks) { Collection<CollapsibleEntryRegistryImpl.Entry> entries = ((CollapsibleEntryRegistryImpl) CollapsibleEntryRegistry.getInstance()).getEntries(); InternalLogger.getInstance().debug("Preparing collapsed entry groups cache with %d entries and %d stacks", entries.size(), stacks.size()); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java index 942e61ad8..c756205e3 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java @@ -35,7 +35,7 @@ import me.shedaniel.rei.api.common.registry.ReloadStage; import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.impl.common.InternalLogger; -import me.shedaniel.rei.impl.common.util.HashedEntryStackWrapper; +import me.shedaniel.rei.impl.common.util.HNEntryStackWrapper; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.world.item.Item; @@ -76,7 +76,7 @@ public class EntryRegistryImpl implements EntryRegistry { @Override public void startReload() { this.listeners.clear(); - this.registryList.collectHashed().clear(); + this.registryList.collectHN().clear(); this.entriesHash = new LongOpenHashSet(); this.filteredList = new PreFilteredEntryList(this, this.registryList); this.listeners.add(filteredList); @@ -116,17 +116,17 @@ public class EntryRegistryImpl implements EntryRegistry { return Collections.unmodifiableList(filteredList.getList()); } - public List<HashedEntryStackWrapper> getPreFilteredComplexList() { + public List<HNEntryStackWrapper> getPreFilteredComplexList() { return Collections.unmodifiableList(filteredList.getComplexList()); } - public List<HashedEntryStackWrapper> getComplexList() { - return Collections.unmodifiableList(registryList.collectHashed()); + public List<HNEntryStackWrapper> getComplexList() { + return Collections.unmodifiableList(registryList.collectHN()); } @Override public void refilter() { - List<HashedEntryStackWrapper> stacks = registryList.collectHashed(); + List<HNEntryStackWrapper> stacks = registryList.collectHN(); for (EntryRegistryListener listener : listeners) { listener.onReFilter(stacks); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryList.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryList.java index 5b39024d8..101743097 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryList.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryList.java @@ -25,7 +25,7 @@ package me.shedaniel.rei.impl.common.entry.type; import it.unimi.dsi.fastutil.longs.LongList; import me.shedaniel.rei.api.common.entry.EntryStack; -import me.shedaniel.rei.impl.common.util.HashedEntryStackWrapper; +import me.shedaniel.rei.impl.common.util.HNEntryStackWrapper; import java.util.List; import java.util.stream.Stream; @@ -37,7 +37,7 @@ public interface EntryRegistryList { List<EntryStack<?>> collect(); - List<HashedEntryStackWrapper> collectHashed(); + List<HNEntryStackWrapper> collectHN(); int indexOf(EntryStack<?> stack); diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryListImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryListImpl.java index d82343d49..6c260455a 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryListImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryListImpl.java @@ -25,6 +25,7 @@ package me.shedaniel.rei.impl.common.entry.type; import it.unimi.dsi.fastutil.longs.LongList; import me.shedaniel.rei.api.common.entry.EntryStack; +import me.shedaniel.rei.impl.common.util.HNEntryStackWrapper; import me.shedaniel.rei.impl.common.util.HashedEntryStackWrapper; import net.minecraft.core.registries.BuiltInRegistries; @@ -35,7 +36,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; public class EntryRegistryListImpl implements EntryRegistryList { - private final List<HashedEntryStackWrapper> hashedList = new ArrayList<>(BuiltInRegistries.ITEM.keySet().size() + 100); + private final List<HNEntryStackWrapper> hashedList = new ArrayList<>(BuiltInRegistries.ITEM.keySet().size() + 100); private final List<EntryStack<?>> list = createMappedList(hashedList); public EntryRegistryListImpl() { @@ -61,7 +62,7 @@ public class EntryRegistryListImpl implements EntryRegistryList { } @Override - public List<HashedEntryStackWrapper> collectHashed() { + public List<HNEntryStackWrapper> collectHN() { return hashedList; } @@ -77,20 +78,20 @@ public class EntryRegistryListImpl implements EntryRegistryList { @Override public void add(EntryStack<?> stack, long hashExact) { - hashedList.add(new HashedEntryStackWrapper(stack, hashExact)); + hashedList.add(new HNEntryStackWrapper(stack, hashExact)); } @Override public void add(int index, EntryStack<?> stack, long hashExact) { - hashedList.add(index, new HashedEntryStackWrapper(stack, hashExact)); + hashedList.add(index, new HNEntryStackWrapper(stack, hashExact)); } @Override public void addAll(List<EntryStack<?>> stacks, LongList hashes) { hashedList.addAll(new AbstractList<>() { @Override - public HashedEntryStackWrapper get(int index) { - return new HashedEntryStackWrapper(stacks.get(index), hashes.getLong(index)); + public HNEntryStackWrapper get(int index) { + return new HNEntryStackWrapper(stacks.get(index), hashes.getLong(index)); } @Override @@ -104,8 +105,8 @@ public class EntryRegistryListImpl implements EntryRegistryList { public void addAll(int index, List<EntryStack<?>> stacks, LongList hashes) { hashedList.addAll(index, new AbstractList<>() { @Override - public HashedEntryStackWrapper get(int index) { - return new HashedEntryStackWrapper(stacks.get(index), hashes.getLong(index)); + public HNEntryStackWrapper get(int index) { + return new HNEntryStackWrapper(stacks.get(index), hashes.getLong(index)); } @Override @@ -134,7 +135,7 @@ public class EntryRegistryListImpl implements EntryRegistryList { return list; } - private static List<EntryStack<?>> createMappedList(List<HashedEntryStackWrapper> hashedList) { + private static List<EntryStack<?>> createMappedList(List<HNEntryStackWrapper> hashedList) { return new AbstractList<>() { @Override public EntryStack<?> get(int index) { @@ -148,12 +149,12 @@ public class EntryRegistryListImpl implements EntryRegistryList { @Override public void add(int index, EntryStack<?> element) { - hashedList.add(index, new HashedEntryStackWrapper(element)); + hashedList.add(index, new HNEntryStackWrapper(element)); } @Override public EntryStack<?> set(int index, EntryStack<?> element) { - return hashedList. |
