aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-11-09 22:22:39 +0800
committershedaniel <daniel@shedaniel.me>2022-11-09 22:23:11 +0800
commita932ccf66dc4f0b14de780879b00e4d4a9ea1f0c (patch)
treedaec80c222da6969bef0c42f0b1636a21381438b
parent66bd26b6ab2172a834d06e9f70d09a659faa8ebd (diff)
parentc6f180f73bcbf5aa23b8b741e6a4f617439214e5 (diff)
downloadRoughlyEnoughItems-a932ccf66dc4f0b14de780879b00e4d4a9ea1f0c.tar.gz
RoughlyEnoughItems-a932ccf66dc4f0b14de780879b00e4d4a9ea1f0c.tar.bz2
RoughlyEnoughItems-a932ccf66dc4f0b14de780879b00e4d4a9ea1f0c.zip
Merge remote-tracking branch 'origin/9.x-1.19' into feature/1.19.3
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/config/ConfigObject.java5
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringContext.java56
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringResult.java (renamed from runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/AbstractFilteringRule.java)23
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringResultFactory.java (renamed from runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringCache.java)10
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringRule.java66
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringRuleType.java148
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringRuleTypeRegistry.java77
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/base/BasicFilteringRule.java (renamed from runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringContext.java)35
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/plugins/REIClientPlugin.java10
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/client/registry/category/CategoryRegistry.java16
-rw-r--r--api/src/main/java/me/shedaniel/rei/api/common/util/CollectionUtils.java69
-rw-r--r--api/src/main/java/me/shedaniel/rei/impl/ClientInternals.java6
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java14
-rw-r--r--forge/build.gradle7
-rw-r--r--forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinFontSet.java60
-rw-r--r--forge/src/main/resources/rei.mixins.json1
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCoreClient.java5
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/REIRuntimeImpl.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java71
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java18
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringAddRuleScreen.java23
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringCategoriesEntry.java112
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringCategoriesScreen.java246
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringEntry.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRuleOptionsScreen.java6
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/FilteringRulesScreen.java21
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/NoFilteringCategoriesEntry.java102
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/config/entries/ReloadPluginsEntry.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringContextImpl.java53
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringResult.java93
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringResultImpl.java27
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringRule.java86
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/BasicFilteringRuleImpl.java155
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/BasicFilteringRuleType.java62
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/FilteringRuleTypeRegistryImpl.java87
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/ManualFilteringRule.java52
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/ManualFilteringRuleType.java (renamed from runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringCacheImpl.java)44
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRule.java167
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/rules/SearchFilteringRuleType.java178
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/dragging/CurrentDraggingStack.java9
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java67
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java83
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java73
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/ConfigButtonWidget.java14
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/EntryWidget.java16
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/TabContainerWidget.java202
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/TabWidget.java41
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListSearchManager.java21
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/entrylist/EntryListStackEntry.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/favorites/history/DisplayEntry.java12
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/registry/category/CategoryRegistryImpl.java11
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/registry/display/DisplayRegistryImpl.java46
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/search/AsyncSearchManager.java196
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/search/SearchProviderImpl.java4
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/search/argument/Argument.java98
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/search/method/InputMethodRegistryImpl.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/util/ThreadCreator.java64
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/EntryRegistryImpl.java6
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/entry/type/PreFilteredEntryList.java22
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/plugins/PluginManagerImpl.java12
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/transfer/MenuInfoRegistryImpl.java25
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/plugin/client/runtime/FilteredStacksVisibilityHandler.java20
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/plugin/client/runtime/SearchFilterPrepareWatcher.java2
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/plugin/test/REITestPlugin.java16
-rwxr-xr-xruntime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json8
65 files changed, 2489 insertions, 804 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 c994980cd..a932071db 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
@@ -28,6 +28,7 @@ import me.shedaniel.rei.api.client.REIRuntime;
import me.shedaniel.rei.api.client.config.entry.EntryStackProvider;
import me.shedaniel.rei.api.client.favorites.FavoriteEntry;
import me.shedaniel.rei.api.client.gui.config.*;
+import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.resources.ResourceLocation;
@@ -35,6 +36,7 @@ import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import java.util.List;
+import java.util.Map;
@Environment(EnvType.CLIENT)
public interface ConfigObject {
@@ -311,6 +313,9 @@ public interface ConfigObject {
boolean shouldFilterDisplays();
@ApiStatus.Experimental
+ Map<CategoryIdentifier<?>, Boolean> getFilteringQuickCraftCategories();
+
+ @ApiStatus.Experimental
boolean shouldAsyncSearch();
@ApiStatus.Experimental
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringContext.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringContext.java
new file mode 100644
index 000000000..d46709af9
--- /dev/null
+++ b/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringContext.java
@@ -0,0 +1,56 @@
+/*
+ * 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.api.client.entry.filtering;
+
+import me.shedaniel.rei.api.common.entry.EntryStack;
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+import org.jetbrains.annotations.ApiStatus;
+
+import java.util.Collection;
+
+@ApiStatus.Experimental
+@Environment(EnvType.CLIENT)
+public interface FilteringContext {
+ /**
+ * Returns the list of stacks that are previously marked as <b>shown</b> from other filtering rules.
+ *
+ * @return the list of stacks that are previously marked as shown from other filtering rules.
+ */
+ Collection<EntryStack<?>> getShownStacks();
+
+ /**
+ * Returns the list of stacks that have not been processed by any filtering rules.
+ *
+ * @return the list of stacks that have not been processed by any filtering rules.
+ */
+ Collection<EntryStack<?>> getUnsetStacks();
+
+ /**
+ * Returns the list of stacks that are previously marked as <b>hidden</b> from other filtering rules.
+ *
+ * @return the list of stacks that are previously marked as hidden from other filtering rules.
+ */
+ Collection<EntryStack<?>> getHiddenStacks();
+}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/AbstractFilteringRule.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringResult.java
index 4ab670fbc..4d4392ae9 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/AbstractFilteringRule.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringResult.java
@@ -21,20 +21,23 @@
* SOFTWARE.
*/
-package me.shedaniel.rei.impl.client.entry.filtering;
+package me.shedaniel.rei.api.client.entry.filtering;
+import me.shedaniel.rei.api.common.entry.EntryStack;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
+import org.jetbrains.annotations.ApiStatus;
+
+import java.util.Collection;
@Environment(EnvType.CLIENT)
-public abstract class AbstractFilteringRule<T extends AbstractFilteringRule<?>> implements FilteringRule<T> {
- @Override
- public boolean equals(Object obj) {
- return getClass() == obj.getClass();
- }
+@ApiStatus.Experimental
+public interface FilteringResult {
+ FilteringResult hide(EntryStack<?> stack);
+
+ FilteringResult hide(Collection<? extends EntryStack<?>> stacks);
+
+ FilteringResult show(EntryStack<?> stack);
- @Override
- public int hashCode() {
- return getClass().hashCode();
- }
+ FilteringResult show(Collection<? extends EntryStack<?>> stacks);
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringCache.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringResultFactory.java
index 388652210..fa391362a 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/entry/filtering/FilteringCache.java
+++ b/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringResultFactory.java
@@ -21,11 +21,9 @@
* SOFTWARE.
*/
-package me.shedaniel.rei.impl.client.entry.filtering;
+package me.shedaniel.rei.api.client.entry.filtering;
-import org.jetbrains.annotations.Nullable;
-
-public interface FilteringCache {
- @Nullable
- Object getCache(FilteringRule<?> rule);
+@FunctionalInterface
+public interface FilteringResultFactory {
+ FilteringResult create();
}
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringRule.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringRule.java
new file mode 100644
index 000000000..1f3cb5b50
--- /dev/null
+++ b/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringRule.java
@@ -0,0 +1,66 @@
+/*
+ * 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.api.client.entry.filtering;
+
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * A filtering rule type that is used to filter the entries on the entry panel,
+ * dictate what shows up in slots, or hide the entire display if all ingredients are filtered.
+ *
+ * @param <Cache> the type of the cache
+ */
+@ApiStatus.Experimental
+@Environment(EnvType.CLIENT)
+public interface FilteringRule<Cache> {
+ /**
+ * Returns the type of this filtering rule.
+ *
+ * @return the type of this filtering rule
+ */
+ FilteringRuleType<? extends FilteringRule<Cache>> getType();
+
+ /**
+ * Prepares the cache for this filtering rule.
+ *
+ * @param async whether the cache should be prepared asynchronously
+ * @return the cache
+ */
+ default Cache prepareCache(boolean async) {
+ return null;
+ }
+
+ /**
+ * Processes the specified entry with the specified cache.
+ *
+ * @param context the context of this filtering
+ * @param resultFactory the result factory
+ * @param cache the cache
+ * @param async whether the stacks should be processed asynchronously
+ * @return the result of the processing
+ */
+ FilteringResult processFilteredStacks(FilteringContext context, FilteringResultFactory resultFactory, Cache cache, boolean async);
+} \ No newline at end of file
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringRuleType.java b/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringRuleType.java
new file mode 100644
index 000000000..7891ebbc5
--- /dev/null
+++ b/api/src/main/java/me/shedaniel/rei/api/client/entry/filtering/FilteringRuleType.java
@@ -0,0 +1,148 @@
+/*
+ * 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.api.client.entry.filtering;
+
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+import net.minecraft.client.gui.screens.Screen;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.network.chat.Component;
+import net.minecraft.resources.ResourceLocation;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Objects;
+import java.util.function.Function;
+
+/**
+ * A type of filtering rule. A filtering rule will filter the entries on the entry panel,
+ * dictate what shows up in slots, or hide the entire display if all ingredients are filtered.
+ *
+ * @param <T> the type of the filtering rule
+ */
+@ApiStatus.Experimental
+@Environment(EnvType.CLIENT)
+public interface FilteringRuleType<T extends FilteringRule<?>> {
+ /**
+ * Serializes the specified filtering rule to a compound tag.
+ *
+ * @param rule the filtering rule
+ * @param tag the compound tag
+ * @return the serialized compound tag
+ */
+ static CompoundTag save(FilteringRule<?> rule, CompoundTag tag) {
+ tag.putString("id", rule.getType().getId().toString());
+ tag.put("rule", ((FilteringRuleType<FilteringRule<?>>) rule.getType()).saveTo(rule, new CompoundTag()));
+ return tag;
+ }
+
+ /**
+ * Serializes the specified filtering rule to a compound tag.
+ *
+ * @param rule the filtering rule
+ * @param tag the compound tag
+ * @return the serialized compound tag
+ */
+ CompoundTag saveTo(T rule, CompoundTag tag);
+
+ /**
+ * Deserializes the specified compound tag to a filtering rule.
+ *
+ * @param tag the compound tag
+ * @return the deserialized filtering rule
+ */
+ @Nullable
+ static FilteringRule&l