diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-08-05 01:30:08 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-08-26 10:53:55 +0900 |
| commit | 8c13c015031a0de865d2e767cd8e879754f803e2 (patch) | |
| tree | 2bb6fa6578b63d1c216b863a6c4206295c044b36 /runtime-engine | |
| parent | 8f5d3ef632f3d1a733c98ce5607c9fd5a0fd7567 (diff) | |
| download | RoughlyEnoughItems-8c13c015031a0de865d2e767cd8e879754f803e2.tar.gz RoughlyEnoughItems-8c13c015031a0de865d2e767cd8e879754f803e2.tar.bz2 RoughlyEnoughItems-8c13c015031a0de865d2e767cd8e879754f803e2.zip | |
More work
Diffstat (limited to 'runtime-engine')
57 files changed, 3819 insertions, 143 deletions
diff --git a/runtime-engine/categories/src/main/java/me/shedaniel/rei/impl/common/category/CategoryIdentifierConstructorImpl.java b/runtime-engine/categories/src/main/java/me/shedaniel/rei/impl/common/category/CategoryIdentifierConstructorImpl.java index a4246ccec..a3eb2ae2f 100644 --- a/runtime-engine/categories/src/main/java/me/shedaniel/rei/impl/common/category/CategoryIdentifierConstructorImpl.java +++ b/runtime-engine/categories/src/main/java/me/shedaniel/rei/impl/common/category/CategoryIdentifierConstructorImpl.java @@ -25,13 +25,13 @@ package me.shedaniel.rei.impl.common.category; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.display.Display; -import me.shedaniel.rei.impl.Internals; +import me.shedaniel.rei.impl.common.provider.CategoryIdentifierConstructor; import net.minecraft.resources.ResourceLocation; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -public class CategoryIdentifierConstructorImpl implements Internals.CategoryIdentifierConstructor { +public class CategoryIdentifierConstructorImpl implements CategoryIdentifierConstructor { private static final Map<String, CategoryIdentifier<?>> CACHE = new ConcurrentHashMap<>(); @Override diff --git a/runtime-engine/categories/src/main/resources/META-INF/services/me.shedaniel.rei.impl.Internals.CategoryIdentifierConstructor b/runtime-engine/categories/src/main/resources/META-INF/services/me.shedaniel.rei.impl.common.provider.CategoryIdentifierConstructor index 6909538ca..6909538ca 100644 --- a/runtime-engine/categories/src/main/resources/META-INF/services/me.shedaniel.rei.impl.Internals.CategoryIdentifierConstructor +++ b/runtime-engine/categories/src/main/resources/META-INF/services/me.shedaniel.rei.impl.common.provider.CategoryIdentifierConstructor diff --git a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java index 25c4aeb16..4f8e6bd62 100644 --- a/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java +++ b/runtime-engine/configs/src/main/java/me/shedaniel/rei/impl/client/config/ConfigManagerImpl.java @@ -50,7 +50,6 @@ import me.shedaniel.rei.api.client.REIRuntime; import me.shedaniel.rei.api.client.config.ConfigManager; import me.shedaniel.rei.api.client.config.addon.ConfigAddonRegistry; import me.shedaniel.rei.api.client.config.entry.EntryStackProvider; -import me.shedaniel.rei.api.client.entry.filtering.FilteringRule; import me.shedaniel.rei.api.client.favorites.FavoriteEntry; import me.shedaniel.rei.api.client.gui.config.CheatingMode; import me.shedaniel.rei.api.client.gui.config.DisplayScreenType; @@ -58,13 +57,12 @@ import me.shedaniel.rei.api.client.gui.config.SyntaxHighlightingMode; import me.shedaniel.rei.api.client.overlay.ScreenOverlay; import me.shedaniel.rei.api.client.registry.entry.EntryRegistry; import me.shedaniel.rei.api.common.entry.EntryStack; +import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.api.common.util.ImmutableTextComponent; -import me.shedaniel.rei.impl.Internals; +import me.shedaniel.rei.impl.common.Internals; import me.shedaniel.rei.impl.client.config.addon.ConfigAddonRegistryImpl; import me.shedaniel.rei.impl.client.config.entries.*; -import me.shedaniel.rei.impl.client.entry.filtering.rules.ManualFilteringRule; import me.shedaniel.rei.impl.client.gui.credits.CreditsScreen; -import me.shedaniel.rei.impl.client.gui.performance.entry.PerformanceEntry; import me.shedaniel.rei.impl.common.InternalLogger; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -260,9 +258,6 @@ public class ConfigManagerImpl implements ConfigManagerInternal { @Override public void saveConfig() { - if (getConfig().getFilteringRules().stream().noneMatch(FilteringRule::isManual)) { - getConfig().getFilteringRules().add(new ManualFilteringRule()); - } AutoConfig.getConfigHolder(ConfigObjectImpl.class).registerLoadListener((configHolder, configObject) -> { object = configObject; return InteractionResult.PASS; @@ -313,7 +308,7 @@ public class ConfigManagerImpl implements ConfigManagerInternal { ).build(); builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, feedbackEntry); builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, new ReloadPluginsEntry(220)); - builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().add(0, new PerformanceEntry(220)); + builder.getOrCreateCategory(new TranslatableComponent("config.roughlyenoughitems.advanced")).getEntries().addAll(0, CollectionUtils.flatMap(Internals.resolveServices(SystemSetup.class), SystemSetup::collectAdvanced)); } return builder.setAfterInitConsumer(screen -> { ConfigAddonRegistryImpl addonRegistry = (ConfigAddonRegistryImpl) ConfigAddonRegistry.getInstance(); 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 ae2008f0a..e13b0e54d 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 @@ -36,7 +36,7 @@ import me.shedaniel.rei.api.client.config.entry.EntryStackProvider; import me.shedaniel.rei.api.client.entry.filtering.FilteringRule; import me.shedaniel.rei.api.client.favorites.FavoriteEntry; import me.shedaniel.rei.api.client.gui.config.*; -import me.shedaniel.rei.impl.ClientInternals; +import me.shedaniel.rei.impl.client.ClientInternals; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; @@ -367,11 +367,6 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { return advanced.filtering.shouldFilterDisplays; } - @ApiStatus.Internal - public List<FilteringRule> getFilteringRules() { - return advanced.filtering.filteringRules; - } - @Override @ApiStatus.Experimental public boolean shouldAsyncSearch() { 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 96c3542c6..21ce7ac95 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 @@ -45,7 +45,7 @@ import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds; import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.common.util.ImmutableTextComponent; -import me.shedaniel.rei.impl.ClientInternals; +import me.shedaniel.rei.impl.client.ClientInternals; import me.shedaniel.rei.impl.client.config.ConfigManagerInternal; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; 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 9a576014c..58cca6382 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 @@ -25,7 +25,7 @@ package me.shedaniel.rei.impl.client.gui.credits; import com.mojang.blaze3d.vertex.PoseStack; import me.shedaniel.clothconfig2.gui.widget.DynamicSmoothScrollingEntryListWidget; -import me.shedaniel.rei.impl.client.gui.text.TextTransformations; +import me.shedaniel.rei.impl.client.util.TextTransformations; import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.client.Minecraft; diff --git a/runtime-engine/default-runtime-plugin/src/main/java/me/shedaniel/rei/impl/client/search/method/unihan/BomopofoInputMethod.java b/runtime-engine/default-runtime-plugin/src/main/java/me/shedaniel/rei/impl/client/search/method/unihan/BomopofoInputMethod.java new file mode 100644 index 000000000..0054c2bc7 --- /dev/null +++ b/runtime-engine/default-runtime-plugin/src/main/java/me/shedaniel/rei/impl/client/search/method/unihan/BomopofoInputMethod.java @@ -0,0 +1,142 @@ +/* + * 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.search.method.unihan; + +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * MIT License + * <p> + * Copyright (c) 2019 Juntong Liu + * <p> + * 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: + * <p> + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * <p> + * 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. + */ +public class BomopofoInputMethod extends PinyinInputMethod { + private static final Map<IntList, IntList> CONVERSION = Stream.of(new String[][]{ + {"", ""}, {"0", ""}, {"1", " "}, {"2", "6"}, {"3", "3"}, + {"4", "4"}, {"a", "8"}, {"ai", "9"}, {"an", "0"}, {"ang", ";"}, + {"ao", "l"}, {"b", "1"}, {"c", "h"}, {"ch", "t"}, {"d", "2"}, + {"e", "k"}, {"ei", "o"}, {"en", "p"}, {"eng", "/"}, {"er", "-"}, + {"f", "z"}, {"g", "e"}, {"h", "c"}, {"i", "u"}, {"ia", "u8"}, + {"ian", "u0"}, {"iang", "u;"}, {"iao", "ul"}, {"ie", "u,"}, {"in", "up"}, + {"ing", "u/"}, {"iong", "m/"}, {"iu", "u."}, {"j", "r"}, {"k", "d"}, + {"l", "x"}, {"m", "a"}, {"n", "s"}, {"o", "i"}, {"ong", "j/"}, + {"ou", "."}, {"p", "q"}, {"q", "f"}, {"r", "b"}, {"s", "n"}, + {"sh", "g"}, {"t", "w"}, {"u", "j"}, {"ua", "j8"}, {"uai", "j9"}, + {"uan", "j0"}, {"uang", "j;"}, {"uen", "mp"}, {"ueng", "j/"}, {"ui", "jo"}, + {"un", "jp"}, {"uo", "ji"}, {"v", "m"}, {"van", "m0"}, {"vang", "m;"}, + {"ve", "m,"}, {"vn", "mp"}, {"w", "j"}, {"x", "v"}, {"y", "u"}, + {"z", "y"}, {"zh", "5"}, + }).collect(Collectors.toMap(d -> IntList.of(d[0].codePoints().toArray()), d -> IntList.of(d[1].trim().codePoints().toArray()))); + + public BomopofoInputMethod(UniHanManager manager) { + super(manager); |
