From f44f0056fa9ce0664d9564000a860be353cd7379 Mon Sep 17 00:00:00 2001 From: GaLi <3096147684@qq.com> Date: Mon, 2 Mar 2026 10:51:54 +0800 Subject: [PATCH] =?UTF-8?q?ATM10=205.5=E7=89=88=E6=9C=AC=E4=B8=AD,?= =?UTF-8?q?=E6=94=BE=E7=BD=AE=E8=A3=85=E9=85=8D=E7=9F=A9=E9=98=B5=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E6=96=B9=E5=9D=97=E4=BC=9A=E5=AF=BC=E8=87=B4=E6=B8=B8?= =?UTF-8?q?=E6=88=8F=E5=B4=A9=E6=BA=83=20#46?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/extendedae_plus/ExtendedAEPlus.java | 101 +++++++++--------- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/src/main/java/com/extendedae_plus/ExtendedAEPlus.java b/src/main/java/com/extendedae_plus/ExtendedAEPlus.java index 217bd9a..e077606 100644 --- a/src/main/java/com/extendedae_plus/ExtendedAEPlus.java +++ b/src/main/java/com/extendedae_plus/ExtendedAEPlus.java @@ -94,6 +94,58 @@ public class ExtendedAEPlus { StorageCells.addCellHandler(InfinityBigIntegerCellHandler.INSTANCE); // 绑定 AE2 的 CraftingBlockEntity 到本模组的自定义加速器方块,避免 AEBaseEntityBlock.blockEntityType 为空 + try { + AEBaseEntityBlock b4 = (AEBaseEntityBlock) ModBlocks.ACCELERATOR_4x.get(); + AEBaseEntityBlock b16 = (AEBaseEntityBlock) ModBlocks.ACCELERATOR_16x.get(); + AEBaseEntityBlock b64 = (AEBaseEntityBlock) ModBlocks.ACCELERATOR_64x.get(); + AEBaseEntityBlock b256 = (AEBaseEntityBlock) ModBlocks.ACCELERATOR_256x.get(); + AEBaseEntityBlock b1024 = (AEBaseEntityBlock) ModBlocks.ACCELERATOR_1024x.get(); + + // 使用我们自定义的 CraftingBlockEntity 类型,它的有效方块列表包含自定义加速器 + var type = ModBlockEntities.EPLUS_CRAFTING_UNIT_BE.get(); + // 不提供专用 ticker(AE2 会在其注册时按接口注入),此处传 null 即可 + b4.setBlockEntity(CraftingBlockEntity.class, type, null, null); + b16.setBlockEntity(CraftingBlockEntity.class, type, null, null); + b64.setBlockEntity(CraftingBlockEntity.class, type, null, null); + b256.setBlockEntity(CraftingBlockEntity.class, type, null, null); + b1024.setBlockEntity(CraftingBlockEntity.class, type, null, null); + LOGGER.info("Bound AE2 CraftingBlockEntity to ExtendedAE Plus accelerators."); + + // 绑定装配矩阵上传核心方块实体类型,避免 blockEntityClass 为 null 的问题 + ModBlocks.ASSEMBLER_MATRIX_UPLOAD_CORE.get().setBlockEntity( + com.extendedae_plus.content.matrix.UploadCoreBlockEntity.class, + ModBlockEntities.UPLOAD_CORE_BE.get(), + null, + null + ); + + ModBlocks.ASSEMBLER_MATRIX_SPEED_PLUS.get().setBlockEntity( + SpeedCorePlusBlockEntity.class, + ModBlockEntities.ASSEMBLER_MATRIX_SPEED_PLUS_BE.get(), + null, + null + ); + + ModBlocks.ASSEMBLER_MATRIX_CRAFTER_PLUS.get().setBlockEntity( + CrafterCorePlusBlockEntity.class, + ModBlockEntities.ASSEMBLER_MATRIX_CRAFTER_PLUS_BE.get(), + null, + null + ); + + ModBlocks.ASSEMBLER_MATRIX_PATTERN_PLUS.get().setBlockEntity( + PatternCorePlusBlockEntity.class, + ModBlockEntities.ASSEMBLER_MATRIX_PATTERN_PLUS_BE.get(), + null, + null + ); + + LOGGER.info("Bound UploadCoreBlockEntity to assembler matrix upload core block."); + } catch (Throwable t) { + LOGGER.error("Failed to bind block entities: {}", t.toString()); + throw new RuntimeException("Critical error: Failed to bind block entities", t); + } + event.enqueueWork(() -> { try { // 注册升级卡 @@ -117,55 +169,8 @@ public class ExtendedAEPlus { } catch (Throwable t) { LOGGER.warn("Failed to register CuriosItemLocator with AE2 MenuLocators: {}", t.toString()); } - - AEBaseEntityBlock b4 = (AEBaseEntityBlock) ModBlocks.ACCELERATOR_4x.get(); - AEBaseEntityBlock b16 = (AEBaseEntityBlock) ModBlocks.ACCELERATOR_16x.get(); - AEBaseEntityBlock b64 = (AEBaseEntityBlock) ModBlocks.ACCELERATOR_64x.get(); - AEBaseEntityBlock b256 = (AEBaseEntityBlock) ModBlocks.ACCELERATOR_256x.get(); - AEBaseEntityBlock b1024 = (AEBaseEntityBlock) ModBlocks.ACCELERATOR_1024x.get(); - - // 使用我们自定义的 CraftingBlockEntity 类型,它的有效方块列表包含自定义加速器 - var type = ModBlockEntities.EPLUS_CRAFTING_UNIT_BE.get(); - // 不提供专用 ticker(AE2 会在其注册时按接口注入),此处传 null 即可 - b4.setBlockEntity(CraftingBlockEntity.class, type, null, null); - b16.setBlockEntity(CraftingBlockEntity.class, type, null, null); - b64.setBlockEntity(CraftingBlockEntity.class, type, null, null); - b256.setBlockEntity(CraftingBlockEntity.class, type, null, null); - b1024.setBlockEntity(CraftingBlockEntity.class, type, null, null); - LOGGER.info("Bound AE2 CraftingBlockEntity to ExtendedAE Plus accelerators."); - - // 绑定装配矩阵上传核心方块实体类型,避免 blockEntityClass 为 null 的问题 - ModBlocks.ASSEMBLER_MATRIX_UPLOAD_CORE.get().setBlockEntity( - com.extendedae_plus.content.matrix.UploadCoreBlockEntity.class, - ModBlockEntities.UPLOAD_CORE_BE.get(), - null, - null - ); - - ModBlocks.ASSEMBLER_MATRIX_SPEED_PLUS.get().setBlockEntity( - SpeedCorePlusBlockEntity.class, - ModBlockEntities.ASSEMBLER_MATRIX_SPEED_PLUS_BE.get(), - null, - null - ); - - ModBlocks.ASSEMBLER_MATRIX_CRAFTER_PLUS.get().setBlockEntity( - CrafterCorePlusBlockEntity.class, - ModBlockEntities.ASSEMBLER_MATRIX_CRAFTER_PLUS_BE.get(), - null, - null - ); - - ModBlocks.ASSEMBLER_MATRIX_PATTERN_PLUS.get().setBlockEntity( - PatternCorePlusBlockEntity.class, - ModBlockEntities.ASSEMBLER_MATRIX_PATTERN_PLUS_BE.get(), - null, - null - ); - - LOGGER.info("Bound UploadCoreBlockEntity to assembler matrix upload core block."); } catch (Throwable t) { - LOGGER.warn("Failed to bind block entities: {}", t.toString()); + LOGGER.warn("Failed to complete enqueued setup work: {}", t.toString()); } }); }