From f266a137d50b9b24bf89dfe74dd37318dece2e39 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Tue, 1 Nov 2022 13:38:55 +0800 Subject: Fix some debug logger messages --- .../search/method/InputMethodRegistryImpl.java | 2 +- .../impl/common/transfer/MenuInfoRegistryImpl.java | 25 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'runtime/src/main/java') diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/method/InputMethodRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/method/InputMethodRegistryImpl.java index 8cac7824a..ca2e79e77 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/search/method/InputMethodRegistryImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/search/method/InputMethodRegistryImpl.java @@ -98,7 +98,7 @@ public class InputMethodRegistryImpl implements InputMethodRegistry { }).join(); service.shutdown(); - InternalLogger.getInstance().debug("Registered %d input methods: ", inputMethods.size(), + InternalLogger.getInstance().debug("Registered %d input methods: %s", inputMethods.size(), inputMethods.values().stream().map(inputMethod -> inputMethod.getName().getString()).collect(Collectors.joining(", "))); } diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/common/transfer/MenuInfoRegistryImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/common/transfer/MenuInfoRegistryImpl.java index 9278d4e79..7ce40503f 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/common/transfer/MenuInfoRegistryImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/common/transfer/MenuInfoRegistryImpl.java @@ -32,6 +32,7 @@ import me.shedaniel.rei.api.common.transfer.info.MenuInfo; import me.shedaniel.rei.api.common.transfer.info.MenuInfoProvider; import me.shedaniel.rei.api.common.transfer.info.MenuInfoRegistry; import me.shedaniel.rei.api.common.transfer.info.MenuSerializationProviderContext; +import me.shedaniel.rei.impl.common.InternalLogger; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.nbt.CompoundTag; @@ -53,11 +54,28 @@ public class MenuInfoRegistryImpl implements MenuInfoRegistry { map.computeIfAbsent(category, id -> Maps.newLinkedHashMap()) .computeIfAbsent(menuClass, c -> Lists.newArrayList()) .add(menuInfo); + InternalLogger.getInstance().debug("Added menu info for %s [%s]: %s", menuClass, category, menuInfo); } @Override public void registerGeneric(Predicate> categoryPredicate, MenuInfoProvider menuInfo) { - mapGeneric.computeIfAbsent(categoryPredicate, id -> Lists.newArrayList()).add(menuInfo); + mapGeneric.computeIfAbsent(new Predicate<>() { + @Override + public boolean test(CategoryIdentifier categoryIdentifier) { + return categoryPredicate.test(categoryIdentifier); + } + + @Override + public int hashCode() { + return System.identityHashCode(this); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + }, id -> Lists.newArrayList()).add(menuInfo); + InternalLogger.getInstance().debug("Added generic menu info for: %s", menuInfo); } @Override @@ -127,6 +145,11 @@ public class MenuInfoRegistryImpl implements MenuInfoRegistry { mapGeneric.clear(); } + @Override + public void endReload() { + InternalLogger.getInstance().debug("Registered %d menu infos", infoSize()); + } + @Override public void acceptPlugin(REIServerPlugin plugin) { plugin.registerMenuInfo(this); -- cgit