aboutsummaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java8
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java86
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java32
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/logging/FileLogger.java3
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/logging/Log4JLogger.java3
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/logging/Logger.java110
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/logging/MultiLogger.java13
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/impl/common/logging/TransformingLogger.java54
-rw-r--r--runtime/src/main/java/me/shedaniel/rei/plugin/test/REITestPlugin.java4
-rw-r--r--runtime/src/main/resources/roughlyenoughitems.changes.json2
-rw-r--r--runtime/src/main/resources/roughlyenoughitems/2022.2/2022-02-18_01-30.png (renamed from runtime/src/main/resources/roughlyenoughitems/2022.1/2022-02-18_01-30.png)bin33618 -> 33618 bytes
-rw-r--r--runtime/src/main/resources/roughlyenoughitems/2022.2/2022-02-18_01-32.png (renamed from runtime/src/main/resources/roughlyenoughitems/2022.1/2022-02-18_01-32.png)bin9532 -> 9532 bytes
-rw-r--r--runtime/src/main/resources/roughlyenoughitems/2022.2/2022-02-18_09-05.png (renamed from runtime/src/main/resources/roughlyenoughitems/2022.1/2022-02-18_09-05.png)bin70861 -> 70861 bytes
-rw-r--r--runtime/src/main/resources/roughlyenoughitems/2022.2/changelog.md (renamed from runtime/src/main/resources/roughlyenoughitems/2022.1/changelog.md)4
14 files changed, 180 insertions, 139 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
index 5681e6598..d1be18c87 100644
--- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
+++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
@@ -41,6 +41,7 @@ import me.shedaniel.rei.api.common.plugins.REIServerPlugin;
import me.shedaniel.rei.api.common.registry.ReloadStage;
import me.shedaniel.rei.api.common.transfer.info.MenuInfoRegistry;
import me.shedaniel.rei.impl.Internals;
+import me.shedaniel.rei.impl.common.InternalLogger;
import me.shedaniel.rei.impl.common.category.CategoryIdentifierImpl;
import me.shedaniel.rei.impl.common.display.DisplaySerializerRegistryImpl;
import me.shedaniel.rei.impl.common.entry.DeferringEntryTypeProviderImpl;
@@ -54,8 +55,8 @@ import me.shedaniel.rei.impl.common.entry.type.EntryTypeRegistryImpl;
import me.shedaniel.rei.impl.common.fluid.FluidSupportProviderImpl;
import me.shedaniel.rei.impl.common.logging.FileLogger;
import me.shedaniel.rei.impl.common.logging.Log4JLogger;
-import me.shedaniel.rei.impl.common.logging.Logger;
import me.shedaniel.rei.impl.common.logging.MultiLogger;
+import me.shedaniel.rei.impl.common.logging.TransformingLogger;
import me.shedaniel.rei.impl.common.logging.performance.PerformanceLogger;
import me.shedaniel.rei.impl.common.logging.performance.PerformanceLoggerImpl;
import me.shedaniel.rei.impl.common.plugins.PluginManagerImpl;
@@ -74,10 +75,10 @@ import java.util.function.UnaryOperator;
@ApiStatus.Internal
public class RoughlyEnoughItemsCore {
@ApiStatus.Internal
- public static final Logger LOGGER = new MultiLogger(ImmutableList.of(
+ public static final InternalLogger LOGGER = new TransformingLogger(new MultiLogger(ImmutableList.of(
new FileLogger(Platform.getGameFolder().resolve("logs/rei.log")),
new Log4JLogger(LogManager.getFormatterLogger("REI"))
- ));
+ )), message -> "[REI] " + message);
public static final PerformanceLogger PERFORMANCE_LOGGER = new PerformanceLoggerImpl();
static {
@@ -124,6 +125,7 @@ public class RoughlyEnoughItemsCore {
);
},
new MenuInfoRegistryImpl()), "serverPluginManager");
+ Internals.attachInstanceSupplier(LOGGER, "logger");
}
public static void _reloadPlugins(@Nullable ReloadStage stage) {
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java
index 89568931a..f3b18ba39 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/ClientHelperImpl.java
@@ -31,7 +31,6 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongSet;
import me.shedaniel.rei.RoughlyEnoughItemsNetwork;
import me.shedaniel.rei.api.client.ClientHelper;
-import me.shedaniel.rei.api.client.REIRuntime;
import me.shedaniel.rei.api.client.config.ConfigManager;
import me.shedaniel.rei.api.client.config.ConfigObject;
import me.shedaniel.rei.api.client.gui.config.DisplayScreenType;
@@ -40,7 +39,6 @@ import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.client.view.ViewSearchBuilder;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
-import me.shedaniel.rei.api.common.display.Display;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes;
import me.shedaniel.rei.api.common.util.EntryStacks;
@@ -48,7 +46,6 @@ import me.shedaniel.rei.api.common.util.FormattingUtils;
import me.shedaniel.rei.impl.ClientInternals;
import me.shedaniel.rei.impl.client.gui.screen.CompositeDisplayViewingScreen;
import me.shedaniel.rei.impl.client.gui.screen.DefaultDisplayViewingScreen;
-import me.shedaniel.rei.impl.client.gui.screen.UncertainDisplayViewingScreen;
import me.shedaniel.rei.impl.client.view.ViewsImpl;
import me.shedaniel.rei.impl.display.DisplaySpec;
import net.fabricmc.api.EnvType;
@@ -70,6 +67,7 @@ import org.jetbrains.annotations.Nullable;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Supplier;
+import java.util.stream.Stream;
@ApiStatus.Internal
@Environment(EnvType.CLIENT)
@@ -302,14 +300,22 @@ public class ClientHelperImpl implements ClientHelper {
}
return this;
}
+
+ @Override
+ public Stream<DisplaySpec> streamDisplays() {
+ return buildMapInternal().values().stream().flatMap(Collection::stream);
+ }
}
public static final class ViewSearchBuilderImpl extends AbstractViewSearchBuilder {
+ private final Set<CategoryIdentifier<?>> filteringCategories = new HashSet<>();
private final Set<CategoryIdentifier<?>> categories = new HashSet<>();
private final List<EntryStack<?>> recipesFor = new ArrayList<>();
private final List<EntryStack<?>> usagesFor = new ArrayList<>();
@Nullable
private CategoryIdentifier<?> preferredOpenedCategory = null;
+ private boolean mergeDisplays = true;
+ private boolean processVisibilityHandlers = true;
private final Supplier<Map<DisplayCategory<?>, List<DisplaySpec>>> map = Suppliers.memoize(() -> ViewsImpl.buildMapFor(this));
@Override
@@ -364,10 +370,49 @@ public class ClientHelperImpl implements ClientHelper {
}
@Override
+ public ViewSearchBuilder filterCategory(CategoryIdentifier<?> category) {
+ this.filteringCategories.add(category);
+ return this;
+ }
+
+ @Override
+ public ViewSearchBuilder filterCategories(Collection<CategoryIdentifier<?>> categories) {
+ this.filteringCategories.addAll(categories);
+ return this;
+ }
+
+ @Override
+ public Set<CategoryIdentifier<?>> getFilteringCategories() {
+ return filteringCategories;
+ }
+
+ @Override
public Map<DisplayCategory<?>, List<DisplaySpec>> buildMapInternal() {
fillPreferredOpenedCategory();
return this.map.get();
}
+
+ @Override
+ public boolean isMergingDisplays() {
+ return mergeDisplays;
+ }
+
+ @Override
+ public ViewSearchBuilder mergingDisplays(boolean mergingDisplays) {
+ this.mergeDisplays = mergingDisplays;
+ return this;
+ }
+
+ @Override
+ public boolean isProcessingVisibilityHandlers() {
+ return processVisibilityHandlers;
+ }
+
+ @Override
+ public ViewSearchBuilder processingVisibilityHandlers(boolean processingVisibilityHandlers) {
+ this.processVisibilityHandlers = processingVisibilityHandlers;
+ return this;
+ }
}
public static final class LegacyWrapperViewSearchBuilder extends AbstractViewSearchBuilder {
@@ -399,6 +444,21 @@ public class ClientHelperImpl implements ClientHelper {
}
@Override
+ public ViewSearchBuilder filterCategory(CategoryIdentifier<?> category) {
+ return this;
+ }
+
+ @Override
+ public ViewSearchBuilder filterCategories(Collection<CategoryIdentifier<?>> categories) {
+ return this;
+ }
+
+ @Override
+ public Set<CategoryIdentifier<?>> getFilteringCategories() {
+ return Collections.emptySet();
+ }
+
+ @Override
public <T> ViewSearchBuilder addRecipesFor(EntryStack<T> stack) {
return this;
}
@@ -445,5 +505,25 @@ public class ClientHelperImpl implements ClientHelper {
fillPreferredOpenedCategory();
return this.map;
}
+
+ @Override
+ public boolean isMergingDisplays() {
+ return true;
+ }
+
+ @Override
+ public ViewSearchBuilder mergingDisplays(boolean mergingDisplays) {
+ return this;
+ }
+
+ @Override
+ public boolean isProcessingVisibilityHandlers() {
+ return false;
+ }
+
+ @Override
+ public ViewSearchBuilder processingVisibilityHandlers(boolean processingVisibilityHandlers) {
+ return this;
+ }
}
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
index df371c961..4b2ce42e1 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/view/ViewsImpl.java
@@ -90,7 +90,9 @@ public class ViewsImpl implements Views {
}
Stopwatch stopwatch = Stopwatch.createStarted();
+ boolean processingVisibilityHandlers = builder.isProcessingVisibilityHandlers();
Set<CategoryIdentifier<?>> categories = builder.getCategories();
+ Set<CategoryIdentifier<?>> filteringCategories = builder.getFilteringCategories();
List<EntryStack<?>> recipesForStacks = builder.getRecipesFor();
List<EntryStack<?>> usagesForStacks = builder.getUsagesFor();
recipesForStacks = Stream.concat(recipesForStacks.stream(), recipesForStacks.stream().map(EntryStack::wildcard))
@@ -104,14 +106,15 @@ public class ViewsImpl implements Views {
Map<DisplayCategory<?>, List<Display>> result = Maps.newLinkedHashMap();
for (CategoryRegistry.CategoryConfiguration<?> categoryConfiguration : CategoryRegistry.getInstance()) {
DisplayCategory<?> category = categoryConfiguration.getCategory();
- if (CategoryRegistry.getInstance().isCategoryInvisible(category)) continue;
+ if (processingVisibilityHandlers && CategoryRegistry.getInstance().isCategoryInvisible(category)) continue;
CategoryIdentifier<?> categoryId = categoryConfiguration.getCategoryIdentifier();
+ if (!filteringCategories.isEmpty() && !filteringCategories.contains(categoryId)) continue;
List<Display> allRecipesFromCategory = displayRegistry.get((CategoryIdentifier<Display>) categoryId);
Set<Display> set = Sets.newLinkedHashSet();
if (categories.contains(categoryId)) {
for (Display display : allRecipesFromCategory) {
- if (displayRegistry.isDisplayVisible(display)) {
+ if (!processingVisibilityHandlers || displayRegistry.isDisplayVisible(display)) {
set.add(display);
}
}
@@ -121,7 +124,7 @@ public class ViewsImpl implements Views {
continue;
}
for (Display display : allRecipesFromCategory) {
- if (!displayRegistry.isDisplayVisible(display)) continue;
+ if (processingVisibilityHandlers && !displayRegistry.isDisplayVisible(display)) continue;
if (!recipesForStacks.isEmpty()) {
if (isRecipesFor(recipesForStacks, display)) {
set.add(display);
@@ -137,7 +140,11 @@ public class ViewsImpl implements Views {
}
for (EntryStack<?> usagesFor : usagesForStacks) {
if (isStackWorkStationOfCategory(categoryConfiguration, usagesFor)) {
- set.addAll(CollectionUtils.filterToSet(allRecipesFromCategory, displayRegistry::isDisplayVisible));
+ if (processingVisibilityHandlers) {
+ set.addAll(CollectionUtils.filterToSet(allRecipesFromCategory, displayRegistry::isDisplayVisible));
+ } else {
+ set.addAll(allRecipesFromCategory);
+ }
break;
}
}
@@ -151,7 +158,8 @@ public class ViewsImpl implements Views {
for (Map.Entry<CategoryIdentifier<?>, List<DynamicDisplayGenerator<?>>> entry : displayRegistry.getCategoryDisplayGenerators().entrySet()) {
CategoryIdentifier<?> categoryId = entry.getKey();
DisplayCategory<?> category = CategoryRegistry.getInstance().get(categoryId).getCategory();
- if (CategoryRegistry.getInstance().isCategoryInvisible(category)) continue;
+ if (processingVisibilityHandlers && CategoryRegistry.getInstance().isCategoryInvisible(category)) continue;
+ if (!filteringCategories.isEmpty() && !filteringCategories.contains(categoryId)) continue;
Set<Display> set = new LinkedHashSet<>();
generatorsCount += entry.getValue().size();
@@ -165,7 +173,9 @@ public class ViewsImpl implements Views {
}
Consumer<Display> displayConsumer = display -> {
- CollectionUtils.getOrPutEmptyList(result, CategoryRegistry.getInstance().get(display.getCategoryIdentifier()).getCategory()).add(display);
+ CategoryIdentifier<?> categoryIdentifier = display.getCategoryIdentifier();
+ if (!filteringCategories.isEmpty() && !filteringCategories.contains(categoryIdentifier)) return;
+ CollectionUtils.getOrPutEmptyList(result, CategoryRegistry.getInstance().get(categoryIdentifier).getCategory()).add(display);
};
for (DynamicDisplayGenerator<Display> generator : (List<DynamicDisplayGenerator<Display>>) (List<? extends DynamicDisplayGenerator<?>>) displayRegistry.getGlobalDisplayGenerators()) {
generatorsCount++;
@@ -174,7 +184,7 @@ public class ViewsImpl implements Views {
Map<DisplayCategory<?>, List<DisplaySpec>> resultSpeced = (Map<DisplayCategory<?>, List<DisplaySpec>>) (Map) new LinkedHashMap<>(result);
// optimize displays
- if (ConfigObject.getInstance().doMergeDisplayUnderOne()) {
+ if (builder.isMergingDisplays() && ConfigObject.getInstance().doMergeDisplayUnderOne()) {
for (Map.Entry<DisplayCategory<?>, List<Display>> entry : result.entrySet()) {
DisplayMerger<Display> merger = (DisplayMerger<Display>) entry.getKey().getDisplayMerger();
@@ -293,11 +303,13 @@ public class ViewsImpl implements Views {
}
private static <T extends Display> void generateLiveDisplays(DisplayRegistry displayRegistry, DynamicDisplayGenerator<T> generator, ViewSearchBuilder builder, Consumer<T> displayConsumer) {
+ boolean processingVisibilityHandlers = builder.isProcessingVisibilityHandlers();
+
for (EntryStack<?> stack : builder.getRecipesFor()) {
Optional<List<T>> recipeForDisplays = generator.getRecipeFor(stack);
if (recipeForDisplays.isPresent()) {
for (T display : recipeForDisplays.get()) {
- if (displayRegistry.isDisplayVisible(display)) {
+ if (!processingVisibilityHandlers || displayRegistry.isDisplayVisible(display)) {
displayConsumer.accept(display);
}
}
@@ -308,7 +320,7 @@ public class ViewsImpl implements Views {
Optional<List<T>> usageForDisplays = generator.getUsageFor(stack);
if (usageForDisplays.isPresent()) {
for (T display : usageForDisplays.get()) {
- if (displayRegistry.isDisplayVisible(display)) {
+ if (!processingVisibilityHandlers || displayRegistry.isDisplayVisible(display)) {
displayConsumer.accept(display);
}
}
@@ -318,7 +330,7 @@ public class ViewsImpl implements Views {
Optional<List<T>> displaysGenerated = generator.generate(builder);
if (displaysGenerated.isPresent()) {
for (T display : displaysGenerated.get()) {
- if (displayRegistry.isDisplayVisible(display)) {
+ if (!processingVisibilityHandlers || displayRegistry.isDisplayVisible(display)) {
displayConsumer.accept(display);
}
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/FileLogger.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/FileLogger.java
index d773113d7..b1eb4fe62 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/FileLogger.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/FileLogger.java
@@ -23,6 +23,7 @@
package me.shedaniel.rei.impl.common.logging;
+import me.shedaniel.rei.impl.common.InternalLogger;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.logging.log4j.Level;
@@ -33,7 +34,7 @@ import java.nio.file.Path;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-public class FileLogger implements Logger {
+public class FileLogger implements InternalLogger {
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss");
private final Writer writer;
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/Log4JLogger.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/Log4JLogger.java
index 087d007b6..1db77dfe7 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/Log4JLogger.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/Log4JLogger.java
@@ -23,9 +23,10 @@
package me.shedaniel.rei.impl.common.logging;
+import me.shedaniel.rei.impl.common.InternalLogger;
import org.apache.logging.log4j.Level;
-public class Log4JLogger implements Logger {
+public class Log4JLogger implements InternalLogger {
private final org.apache.logging.log4j.Logger logger;
public Log4JLogger(org.apache.logging.log4j.Logger logger) {
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/Logger.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/Logger.java
deleted file mode 100644
index f12bde464..000000000
--- a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/Logger.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.common.logging;
-
-import org.apache.logging.log4j.Level;
-
-public interface Logger {
- void throwException(Throwable throwable);
-
- void log(Level level, String message);
-
- void log(Level level, String message, Throwable throwable);
-
- default void log(Level level, String message, Object... args) {
- log(level, String.format(message, args));
- }
-
- default void fatal(String message) {
- log(Level.FATAL, message);
- }
-
- default void fatal(String message, Throwable throwable) {
- log(Level.FATAL, message, throwable);
- }
-
- default void fatal(String message, Object... args) {
- log(Level.FATAL, String.format(message, args));
- }
-
- default void error(String message) {
- log(Level.ERROR, message);
- }
-
- default void error(String message, Throwable throwable) {
- log(Level.ERROR, message, throwable);
- }
-
- default void error(String message, Object... args) {
- log(Level.ERROR, String.format(message, args));
- }
-
- default void warn(String message) {
- log(Level.WARN, message);
- }
-
- default void warn(String message, Throwable throwable) {
- log(Level.WARN, message, throwable);
- }
-
- default void warn(String message, Object... args) {
- log(Level.WARN, String.format(message, args));
- }
-
- default void info(String message) {
- log(Level.INFO, message);
- }
-
- default void info(String message, Throwable throwable) {
- log(Level.INFO, message, throwable);
- }
-
- default void info(String message, Object... args) {
- log(Level.INFO, String.format(message, args));
- }
-
- default void debug(String message) {
- log(Level.DEBUG, message);
- }
-
- default void debug(String message, Throwable throwable) {
- log(Level.DEBUG, message, throwable);
- }
-
- default void debug(String message, Object... args) {
- log(Level.DEBUG, String.format(message, args));
- }
-
- default void trace(String message) {
- log(Level.TRACE, message);
- }
-
- default void trace(String message, Throwable throwable) {
- log(Level.TRACE, message, throwable);
- }
-
- default void trace(String message, Object... args) {
- log(Level.TRACE, String.format(message, args));
- }
-}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/MultiLogger.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/MultiLogger.java
index e1148b013..9f3d6fbda 100644
--- a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/MultiLogger.java
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/MultiLogger.java
@@ -23,32 +23,33 @@
package me.shedaniel.rei.impl.common.logging;
+import me.shedaniel.rei.impl.common.InternalLogger;
import org.apache.logging.log4j.Level;
-public class MultiLogger implements Logger {
- private final Iterable<Logger> loggers;
+public class MultiLogger implements InternalLogger {
+ private final Iterable<InternalLogger> loggers;
- public MultiLogger(Iterable<Logger> loggers) {
+ public MultiLogger(Iterable<InternalLogger> loggers) {
this.loggers = loggers;
}
@Override
public void throwException(Throwable throwable) {
- for (Logger logger : loggers) {
+ for (InternalLogger logger : loggers) {
logger.throwException(throwable);
}
}
@Override
public void log(Level level, String message) {
- for (Logger logger : loggers) {
+ for (InternalLogger logger : loggers) {
logger.log(level, message);
}
}
@Override
public void log(Level level, String message, Throwable throwable) {
- for (Logger logger : loggers) {
+ for (InternalLogger logger : loggers) {
logger.log(level, message, throwable);
}
}
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/TransformingLogger.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/TransformingLogger.java
new file mode 100644
index 000000000..ed9678c00
--- /dev/null
+++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/logging/TransformingLogger.java
@@ -0,0 +1,54 @@
+/*
+ * 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.common.logging;
+
+import me.shedaniel.rei.impl.common.InternalLogger;
+import org.apache.logging.log4j.Level;
+
+import java.util.function.UnaryOperator;
+
+public class TransformingLogger implements InternalLogger {
+ private final InternalLogger logger;
+ private final UnaryOperator<String> transformer;
+
+ public TransformingLogger(InternalLogger logger, UnaryOperator<String> transformer) {
+ this.logger = logger;
+ this.transformer = transformer;
+ }
+
+ @Override
+ public void throwException(Throwable throwable) {
+ logger.throwException(throwable);
+ }
+
+ @Override
+ public void log(Level level, String message) {
+ logger.log(level, transformer.apply(message));
+ }
+
+ @Override
+ public void log(Level level, String message, Throwable throwable) {
+ logger.log(level, transformer.apply(message), throwable);
+ }
+}
diff --git a/runtime/src/main/java/me/shedaniel/rei/plugin/test/REITestPlugin.java b/runtime/src/main/java/me/shedaniel/rei/plugin/test/REITestPlugin.java
index 43035f012..7eed62ba2 100644
--- a/runtime/src/main/java/me/shedaniel/rei/plugin/test/REITestPlugin.java
+++ b/runtime/src/main/java/me/shedaniel/rei/plugin/test/REITestPlugin.java
@@ -33,6 +33,7 @@ import me.shedaniel.rei.api.common.entry.comparison.ItemComparatorRegistry;
import me.shedaniel.rei.api.common.plugins.PluginManager;
import me.shedaniel.rei.api.common.registry.ReloadStage;
import me.shedaniel.rei.api.common.util.EntryStacks;
+import me.shedaniel.rei.impl.common.InternalLogger;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft;
@@ -42,7 +43,6 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.GameType;
-import org.apache.logging.log4j.LogManager;
import org.jetbrains.annotations.TestOnly;
import java.util.Random;
@@ -56,7 +56,7 @@ public class REITestPlugin implements REIClientPlugin {
@Override
public void preStage(PluginManager<REIClientPlugin> manager, ReloadStage stage) {
- LogManager.getLogger().error("REI Test Plugin is enabled! If you see this unintentionally, please report this!");
+ InternalLogger.getInstance().error("REI Test Plugin is enabled! If you see this unintentionally, please report this!");
}
@Override
diff --git a/runtime/src/main/resources/roughlyenoughitems.changes.json b/runtime/src/main/resources/roughlyenoughitems.changes.json
index 0a3e2be7c..34177eb71 100644
--- a/runtime/src/main/resources/roughlyenoughitems.changes.json
+++ b/runtime/src/main/resources/roughlyenoughitems.changes.json
@@ -1,3 +1,3 @@
{
- "version": "2022.1"
+ "version": "2022.2"
} \ No newline at end of file
diff --git a/runtime/src/main/resources/roughlyenoughitems/2022.1/2022-02-18_01-30.png b/runtime/src/main/resources/roughlyenoughitems/2022.2/2022-02-18_01-30.png
index 85e0ba7af..85e0ba7af 100644
--- a/runtime/src/main/resources/roughlyenoughitems/2022.1/2022-02-18_01-30.png
+++ b/runtime/src/main/resources/roughlyenoughitems/2022.2/2022-02-18_01-30.png
Binary files differ
diff --git a/runtime/src/main/resources/roughlyenoughitems/2022.1/2022-02-18_01-32.png b/runtime/src/main/resources/roughlyenoughitems/2022.2/2022-02-18_01-32.png
index c12af89ee..c12af89ee 100644
--- a/runtime/src/main/resources/roughlyenoughitems/2022.1/2022-02-18_01-32.png
+++ b/runtime/src/main/resources/roughlyenoughitems/2022.2/2022-02-18_01-32.png
Binary files differ
diff --git a/runtime/src/main/resources/roughlyenoughitems/2022.1/2022-02-18_09-05.png b/runtime/src/main/resources/roughlyenoughitems/2022.2/2022-02-18_09-05.png
index 380079ac3..380079ac3 100644
--- a/runtime/src/main/resources/roughlyenoughitems/2022.1/2022-02-18_09-05.png
+++ b/runtime/src/main/resources/roughlyenoughitems/2022.2/2022-02-18_09-05.png
Binary files differ
diff --git a/runtime/src/main/resources/roughlyenoughitems/2022.1/changelog.md b/runtime/src/main/resources/roughlyenoughitems/2022.2/changelog.md
index 74a4e3c5d..ddcc5d0e7 100644
--- a/runtime/src/main/resources/roughlyenoughitems/2022.1/changelog.md
+++ b/runtime/src/main/resources/roughlyenoughitems/2022.2/changelog.md
@@ -27,9 +27,9 @@ Instead of highlighting the items on hover, you can now configure REI to zoom in
With the [REI Feedback Form](https://forms.gle/5tdnK5WN1wng78pV8), we have received a lot of feedback on the
scrolling experience. An overwhelming majority of users (79.1%) is happy with smooth scrolling, so we have decided to
implement this back in REI.
-- **Support for JEI API 9.3** [#781](https://github.com/shedaniel/RoughlyEnoughItems/issues/781)
+- **Support for JEI API 9.5** [#821](https://github.com/shedaniel/RoughlyEnoughItems/issues/821)
-The JEI compatibility layer has been updated to support APIs from JEI 9.3, this is a completely new way for
+The JEI compatibility layer has been updated to support APIs from JEI 9.5, this is a completely new way for
JEI plugins to layout their categories, please report any issues you find with this new update.
- **Filtering of Entries in Recipes** [#783](https://github.com/shedaniel/RoughlyEnoughItems/issues/783)