CtrlQ上传处理样板写入搜索名称修正

This commit is contained in:
GaLi 2026-03-03 19:56:19 +08:00
parent 9fe3336107
commit 7e65588f0c
3 changed files with 21 additions and 4 deletions

View File

@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
loom.platform = forge
org.gradle.parallel=true
mod_version = 1.5.2
mod_version = 1.5.2-fix
maven_group = com.extendedae_plus
archives_name = extendedae_plus

View File

@ -4,6 +4,7 @@ import appeng.api.storage.StorageCells;
import appeng.menu.locator.MenuLocators;
import com.extendedae_plus.api.storage.InfinityBigIntegerCellHandler;
import com.extendedae_plus.client.ClientRegistrar;
import com.extendedae_plus.client.ModKeybindings;
import com.extendedae_plus.config.ModConfig;
import com.extendedae_plus.content.matrix.CrafterCorePlusBlockEntity;
import com.extendedae_plus.content.matrix.PatternCorePlusBlockEntity;
@ -14,6 +15,7 @@ import com.extendedae_plus.util.storage.InfinityStorageManager;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ModelEvent;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.event.TickEvent;
@ -42,9 +44,6 @@ public class ExtendedAEPlus {
// 注册mod初始化事件
modEventBus.addListener(this::commonSetup);
// 注册按键绑定客户端
modEventBus.addListener(com.extendedae_plus.client.ModKeybindings::register);
// 注册方块与方块实体
ModBlocks.BLOCKS.register(modEventBus);
ModBlockEntities.BLOCK_ENTITY_TYPES.register(modEventBus);
@ -148,6 +147,11 @@ public class ExtendedAEPlus {
ModItems.registerPartModels();
} catch (Exception ignored) {}
}
@SubscribeEvent
public static void onRegisterKeyMappings(final RegisterKeyMappingsEvent event) {
ModKeybindings.register(event);
}
}

View File

@ -458,6 +458,19 @@ public class CtrlQPatternKeyHandler {
private static void setLastProcessingNameFromRecipe(Object recipeBase) {
String name = null;
// 处理 RecipeHolder 包装Minecraft 1.20+
if (recipeBase != null && "net.minecraft.world.item.crafting.RecipeHolder".equals(recipeBase.getClass().getName())) {
try {
var valueMethod = recipeBase.getClass().getMethod("value");
Object actualRecipe = valueMethod.invoke(recipeBase);
if (actualRecipe != null) {
recipeBase = actualRecipe;
}
} catch (Throwable ignored) {
}
}
if (recipeBase instanceof Recipe<?> recipe) {
name = RecipeTypeNameConfig.mapRecipeTypeToSearchKey(recipe);
} else if (recipeBase != null