删日志
This commit is contained in:
parent
cf6210103f
commit
7bd15e7d13
|
|
@ -13,28 +13,21 @@ public class CompatibilityTest {
|
|||
* 测试模组兼容性检测
|
||||
*/
|
||||
public static void testCompatibility() {
|
||||
ExtendedAELogger.LOGGER.info("=== ExtendedAE_Plus 兼容性测试开始 ===");
|
||||
|
||||
// 测试appflux模组检测
|
||||
boolean appfluxExists = ModList.get().isLoaded("appflux");
|
||||
ExtendedAELogger.LOGGER.info("ExtendedAE-appflux模组检测结果: {}", appfluxExists ? "存在" : "不存在");
|
||||
|
||||
// 测试升级卡槽功能启用状态
|
||||
boolean shouldEnableUpgrades = UpgradeSlotCompat.shouldEnableUpgradeSlots();
|
||||
ExtendedAELogger.LOGGER.info("升级卡槽功能启用状态: {}", shouldEnableUpgrades ? "启用" : "禁用");
|
||||
|
||||
// 测试Screen升级面板添加状态
|
||||
boolean shouldAddPanel = UpgradeSlotCompat.shouldAddUpgradePanelToScreen();
|
||||
ExtendedAELogger.LOGGER.info("Screen升级面板添加状态: {}", shouldAddPanel ? "启用" : "禁用");
|
||||
|
||||
// 输出兼容性策略
|
||||
if (appfluxExists) {
|
||||
ExtendedAELogger.LOGGER.info("兼容性策略: 检测到ExtendedAE-appflux模组,将使用其升级卡槽功能");
|
||||
} else {
|
||||
ExtendedAELogger.LOGGER.info("兼容性策略: 未检测到ExtendedAE-appflux模组,将使用我们自己的升级卡槽功能");
|
||||
}
|
||||
|
||||
ExtendedAELogger.LOGGER.info("=== ExtendedAE_Plus 兼容性测试完成 ===");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,13 +41,10 @@ public class UpgradeSlotCompat {
|
|||
*/
|
||||
public static boolean shouldEnableUpgradeSlots() {
|
||||
boolean appfluxExists = isAppfluxPresent();
|
||||
ExtendedAELogger.LOGGER.info("ExtendedAE-appflux模组检测: {}", appfluxExists ? "存在" : "不存在");
|
||||
|
||||
if (appfluxExists) {
|
||||
ExtendedAELogger.LOGGER.info("检测到ExtendedAE-appflux模组,跳过我们的升级卡槽功能");
|
||||
return false;
|
||||
} else {
|
||||
ExtendedAELogger.LOGGER.info("未检测到ExtendedAE-appflux模组,启用我们的升级卡槽功能");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,6 @@ public abstract class QuartzCuttingKnifeItemMixin {
|
|||
}
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
LOGGER.info("GregTech CEu 类未找到,跳过配方翻译处理");
|
||||
return null; // GTCEu 不可用
|
||||
} catch (NoSuchFieldException | NoSuchMethodException | IllegalAccessException | java.lang.reflect.InvocationTargetException e) {
|
||||
LOGGER.error("处理 GTCEu 配方翻译失败: {}", e.getMessage());
|
||||
|
|
|
|||
|
|
@ -75,10 +75,6 @@ public abstract class AEBaseScreenMixin {
|
|||
if (key == null) {
|
||||
return;
|
||||
}
|
||||
// Debug: 标记一次发送
|
||||
try {
|
||||
LogUtils.getLogger().info("EAP: Send CraftingMonitorJumpC2SPacket: {}", key);
|
||||
} catch (Throwable ignored2) {}
|
||||
ModNetwork.CHANNEL.sendToServer(new CraftingMonitorJumpC2SPacket(key));
|
||||
cir.setReturnValue(true);
|
||||
} catch (Throwable ignored) {
|
||||
|
|
@ -109,10 +105,6 @@ public abstract class AEBaseScreenMixin {
|
|||
if (key == null) {
|
||||
return;
|
||||
}
|
||||
// Debug: 标记一次发送(打开供应器UI)
|
||||
try {
|
||||
LogUtils.getLogger().info("EAP: Send CraftingMonitorOpenProviderC2SPacket: {}", key);
|
||||
} catch (Throwable ignored2) {}
|
||||
ModNetwork.CHANNEL.sendToServer(new CraftingMonitorOpenProviderC2SPacket(key));
|
||||
cir.setReturnValue(true);
|
||||
} catch (Throwable ignored) {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ public abstract class InterfaceScreenMixin<T extends AEBaseMenu> {
|
|||
if (!eap$isSupportedInterfaceScreen()) {
|
||||
return;
|
||||
}
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] init tail reached, preparing scale buttons."); } catch (Throwable ignored) {}
|
||||
// 避免重复创建
|
||||
if (eap$x2Button == null) {
|
||||
eap$x2Button = new ActionEPPButton((b) -> {
|
||||
|
|
@ -110,7 +109,6 @@ public abstract class InterfaceScreenMixin<T extends AEBaseMenu> {
|
|||
|
||||
// 初次定位
|
||||
eap$relayoutButtons();
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] buttons added and laid out."); } catch (Throwable ignored) {}
|
||||
}
|
||||
|
||||
@Inject(method = "containerTick", at = @At("TAIL"))
|
||||
|
|
@ -123,32 +121,26 @@ public abstract class InterfaceScreenMixin<T extends AEBaseMenu> {
|
|||
if (eap$divideBy2Button != null && !accessor.eap$getRenderables().contains(eap$divideBy2Button)) {
|
||||
accessor.eap$getRenderables().add(eap$divideBy2Button);
|
||||
accessor.eap$getChildren().add(eap$divideBy2Button);
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] re-added divide2 button to renderables."); } catch (Throwable ignored) {}
|
||||
}
|
||||
if (eap$x2Button != null && !accessor.eap$getRenderables().contains(eap$x2Button)) {
|
||||
accessor.eap$getRenderables().add(eap$x2Button);
|
||||
accessor.eap$getChildren().add(eap$x2Button);
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] re-added x2 button to renderables."); } catch (Throwable ignored) {}
|
||||
}
|
||||
if (eap$divideBy5Button != null && !accessor.eap$getRenderables().contains(eap$divideBy5Button)) {
|
||||
accessor.eap$getRenderables().add(eap$divideBy5Button);
|
||||
accessor.eap$getChildren().add(eap$divideBy5Button);
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] re-added divide5 button to renderables."); } catch (Throwable ignored) {}
|
||||
}
|
||||
if (eap$x5Button != null && !accessor.eap$getRenderables().contains(eap$x5Button)) {
|
||||
accessor.eap$getRenderables().add(eap$x5Button);
|
||||
accessor.eap$getChildren().add(eap$x5Button);
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] re-added x5 button to renderables."); } catch (Throwable ignored) {}
|
||||
}
|
||||
if (eap$divideBy10Button != null && !accessor.eap$getRenderables().contains(eap$divideBy10Button)) {
|
||||
accessor.eap$getRenderables().add(eap$divideBy10Button);
|
||||
accessor.eap$getChildren().add(eap$divideBy10Button);
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] re-added divide10 button to renderables."); } catch (Throwable ignored) {}
|
||||
}
|
||||
if (eap$x10Button != null && !accessor.eap$getRenderables().contains(eap$x10Button)) {
|
||||
accessor.eap$getRenderables().add(eap$x10Button);
|
||||
accessor.eap$getChildren().add(eap$x10Button);
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] re-added x10 button to renderables."); } catch (Throwable ignored) {}
|
||||
}
|
||||
// 尺寸变化时重新定位
|
||||
int curLeft = ((AbstractContainerScreenAccessor<?>) (Object) this).eap$getLeftPos();
|
||||
|
|
@ -161,7 +153,6 @@ public abstract class InterfaceScreenMixin<T extends AEBaseMenu> {
|
|||
eap$lastImageWidth = curImgW;
|
||||
eap$lastImageHeight = curImgH;
|
||||
eap$relayoutButtons();
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] relayout due to bounds change: left={}, top={}, w={}, h={}", curLeft, curTop, curImgW, curImgH); } catch (Throwable ignored) {}
|
||||
}
|
||||
// 每帧根据 hoveredSlot 刷新最近一次的配置槽索引
|
||||
eap$updateLastConfigFromHover();
|
||||
|
|
@ -214,10 +205,8 @@ public abstract class InterfaceScreenMixin<T extends AEBaseMenu> {
|
|||
slotField = slotFieldObj;
|
||||
} else if (eap$lastConfigIndex >= 0 && eap$lastConfigIndex < configSlots.size()) {
|
||||
slotField = eap$lastConfigIndex;
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] Using last hovered config index: {}", slotField); } catch (Throwable ignored) {}
|
||||
}
|
||||
if (slotField < 0) {
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] No hovered slot and no last config index; ignoring adjust."); } catch (Throwable ignored) {}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +301,6 @@ public abstract class InterfaceScreenMixin<T extends AEBaseMenu> {
|
|||
if (idx != null && idx >= 0) {
|
||||
if (eap$lastConfigIndex != idx) {
|
||||
eap$lastConfigIndex = idx;
|
||||
try { LogUtils.getLogger().info("[EAP][InterfaceMixin] lastConfigIndex updated: {}", eap$lastConfigIndex); } catch (Throwable ignored) {}
|
||||
}
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ public abstract class PatternProviderLogicCompatMixin implements IUpgradeableObj
|
|||
private void eap$onAppfluxUpgradesChanged(CallbackInfo ci) {
|
||||
try {
|
||||
if (UpgradeSlotCompat.shouldEnableChannelCard()) {
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("监听到appflux升级变化,处理频道卡");
|
||||
// 升级变更,重置并尝试初始化频道卡
|
||||
eap$compatLastChannel = -1;
|
||||
eap$compatHasInitialized = false;
|
||||
|
|
@ -99,12 +98,10 @@ public abstract class PatternProviderLogicCompatMixin implements IUpgradeableObj
|
|||
at = @At("TAIL"))
|
||||
private void eap$compatInitUpgrades(IManagedGridNode mainNode, PatternProviderLogicHost host, int patternInventorySize, CallbackInfo ci) {
|
||||
try {
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("兼容性PatternProviderLogic初始化被调用");
|
||||
|
||||
boolean upgradeSlots = UpgradeSlotCompat.shouldEnableUpgradeSlots();
|
||||
boolean channelCard = UpgradeSlotCompat.shouldEnableChannelCard();
|
||||
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("升级槽功能: {}, 频道卡功能: {}", upgradeSlots, channelCard);
|
||||
|
||||
if (upgradeSlots) {
|
||||
// 只有在升级槽功能启用时才创建升级槽
|
||||
|
|
@ -113,12 +110,9 @@ public abstract class PatternProviderLogicCompatMixin implements IUpgradeableObj
|
|||
1,
|
||||
this::eap$compatOnUpgradesChanged
|
||||
);
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("创建了完整的升级槽");
|
||||
} else if (channelCard) {
|
||||
// 如果装了appflux,我们不创建自己的升级槽,而是监听appflux的升级槽
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("装了appflux,将监听其升级槽来处理频道卡");
|
||||
} else {
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("跳过升级槽创建");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.error("兼容性升级初始化失败", e);
|
||||
|
|
@ -261,7 +255,6 @@ public abstract class PatternProviderLogicCompatMixin implements IUpgradeableObj
|
|||
if (!stack.isEmpty() && stack.getItem() == ModItems.CHANNEL_CARD.get()) {
|
||||
channel = ChannelCardItem.getChannel(stack);
|
||||
found = true;
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("找到频道卡,频道: {}", channel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,11 +28,9 @@ public class AppfluxPatternProviderLogicMixin {
|
|||
at = @At("TAIL"))
|
||||
private void eap$modifyAppfluxUpgradeSlots(IManagedGridNode mainNode, PatternProviderLogicHost host, int patternInventorySize, CallbackInfo ci) {
|
||||
try {
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("AppfluxPatternProviderLogicMixin被调用!");
|
||||
|
||||
// 只有当appflux存在且不启用我们的升级槽时才修改数量
|
||||
if (!UpgradeSlotCompat.shouldEnableUpgradeSlots() && UpgradeSlotCompat.shouldEnableChannelCard()) {
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("尝试修改appflux升级槽数量为2个");
|
||||
|
||||
// 使用反射找到appflux的升级槽字段并替换
|
||||
try {
|
||||
|
|
@ -41,7 +39,6 @@ public class AppfluxPatternProviderLogicMixin {
|
|||
IUpgradeInventory currentUpgrades = (IUpgradeInventory) upgradesField.get(this);
|
||||
|
||||
if (currentUpgrades != null) {
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("找到appflux升级槽,当前大小: {}", currentUpgrades.size());
|
||||
|
||||
// 创建新的2槽升级槽
|
||||
IUpgradeInventory newUpgrades = UpgradeInventories.forMachine(
|
||||
|
|
@ -66,7 +63,6 @@ public class AppfluxPatternProviderLogicMixin {
|
|||
|
||||
// 替换升级槽
|
||||
upgradesField.set(this, newUpgrades);
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.info("成功将appflux升级槽替换为2个槽");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
com.extendedae_plus.util.ExtendedAELogger.LOGGER.error("反射修改appflux升级槽失败", e);
|
||||
|
|
|
|||
|
|
@ -126,7 +126,6 @@ public abstract class GuiExPatternProviderMixin extends PatternProviderScreen<Co
|
|||
try { cfgPages = Math.max(1, ModConfig.INSTANCE.pageMultiplier); } catch (Throwable ignored) {}
|
||||
int calcPages = Math.max(1, (int) Math.ceil(totalSlots / (double) SLOTS_PER_PAGE));
|
||||
int desiredMaxPage = Math.max(cfgPages, calcPages);
|
||||
LOGGER.info("[EAP] GuiExPatternProvider init: totalSlots={}, cfgPages={}, calcPages={}, desiredMaxPage={}", totalSlots, cfgPages, calcPages, desiredMaxPage);
|
||||
// 更新本地最大页
|
||||
this.eap$maxPageLocal = Math.max(1, desiredMaxPage);
|
||||
this.eap$currentPage = 0;
|
||||
|
|
@ -157,8 +156,7 @@ public abstract class GuiExPatternProviderMixin extends PatternProviderScreen<Co
|
|||
} catch (Exception ignored) {}
|
||||
// 同步到本地 GUI 页码
|
||||
this.eap$currentPage = newPage;
|
||||
// 日志与强制重排(放在更新本地页码之后,确保布局读取到新页)
|
||||
LOGGER.info("[EAP] PrevPage clicked: {} -> {} (max={})", currentPage, newPage, maxPage);
|
||||
// 强制重排(放在更新本地页码之后,确保布局读取到新页)
|
||||
this.repositionSlots(SlotSemantics.ENCODED_PATTERN);
|
||||
this.repositionSlots(SlotSemantics.STORAGE);
|
||||
this.hoveredSlot = null;
|
||||
|
|
@ -184,8 +182,7 @@ public abstract class GuiExPatternProviderMixin extends PatternProviderScreen<Co
|
|||
} catch (Exception ignored) {}
|
||||
// 同步到本地 GUI 页码
|
||||
this.eap$currentPage = newPage;
|
||||
// 日志与强制重排(放在更新本地页码之后,确保布局读取到新页)
|
||||
LOGGER.info("[EAP] NextPage clicked: {} -> {} (max={})", currentPage, newPage, maxPage);
|
||||
// 强制重排(放在更新本地页码之后,确保布局读取到新页)
|
||||
this.repositionSlots(SlotSemantics.ENCODED_PATTERN);
|
||||
this.repositionSlots(SlotSemantics.STORAGE);
|
||||
this.hoveredSlot = null;
|
||||
|
|
|
|||
|
|
@ -54,11 +54,9 @@ public class CraftingMonitorJumpC2SPacket {
|
|||
ServerPlayer player = context.getSender();
|
||||
if (player == null) return;
|
||||
|
||||
LogUtils.getLogger().info("EAP[S]: recv CraftingMonitorJumpC2SPacket key={} from {}", msg.what, player.getGameProfile().getName());
|
||||
|
||||
// 必须在 CraftingCPU 界面内
|
||||
if (!(player.containerMenu instanceof appeng.menu.me.crafting.CraftingCPUMenu menu)) {
|
||||
LogUtils.getLogger().info("EAP[S]: not in CraftingCPUMenu, abort");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -69,19 +67,16 @@ public class CraftingMonitorJumpC2SPacket {
|
|||
grid = host.getActionableNode().getGrid();
|
||||
}
|
||||
if (grid == null) {
|
||||
LogUtils.getLogger().info("EAP[S]: grid is null, abort");
|
||||
return;
|
||||
}
|
||||
|
||||
var cs = grid.getCraftingService();
|
||||
if (!(cs instanceof CraftingService craftingService)) {
|
||||
LogUtils.getLogger().info("EAP[S]: craftingService is null/unsupported, abort");
|
||||
return;
|
||||
}
|
||||
|
||||
// 1) 根据 AEKey 找到可能的样板(pattern)
|
||||
Collection<IPatternDetails> patterns = craftingService.getCraftingFor(msg.what);
|
||||
LogUtils.getLogger().info("EAP[S]: patterns found={} for key={}", patterns.size(), msg.what);
|
||||
if (patterns.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -92,9 +87,6 @@ public class CraftingMonitorJumpC2SPacket {
|
|||
int providerCount = 0;
|
||||
for (var provider : providers) {
|
||||
providerCount++;
|
||||
try {
|
||||
LogUtils.getLogger().info("EAP[S]: provider class={}", provider.getClass().getName());
|
||||
} catch (Throwable ignored) {}
|
||||
if (provider instanceof PatternProviderLogic ppl) {
|
||||
// 使用 accessor 获取 host(受保护字段通过 accessor 访问)
|
||||
PatternProviderLogicHost host = ((PatternProviderLogicAccessor) ppl).eap$host();
|
||||
|
|
@ -107,7 +99,6 @@ public class CraftingMonitorJumpC2SPacket {
|
|||
BlockPos targetPos = pbe.getBlockPos().relative(dir);
|
||||
var tbe = serverLevel.getBlockEntity(targetPos);
|
||||
if (tbe instanceof MenuProvider provider1) {
|
||||
LogUtils.getLogger().info("EAP[S]: open screen via MenuProvider at {}", targetPos);
|
||||
NetworkHooks.openScreen(player, provider1, targetPos);
|
||||
context.setPacketHandled(true);
|
||||
return;
|
||||
|
|
@ -115,7 +106,6 @@ public class CraftingMonitorJumpC2SPacket {
|
|||
var tstate = serverLevel.getBlockState(targetPos);
|
||||
var provider2 = tstate.getMenuProvider(serverLevel, targetPos);
|
||||
if (provider2 != null) {
|
||||
LogUtils.getLogger().info("EAP[S]: open screen via state.getMenuProvider at {}", targetPos);
|
||||
NetworkHooks.openScreen(player, provider2, targetPos);
|
||||
context.setPacketHandled(true);
|
||||
return;
|
||||
|
|
@ -138,7 +128,6 @@ public class CraftingMonitorJumpC2SPacket {
|
|||
var state2 = serverLevel.getBlockState(targetPos);
|
||||
var hit = new BlockHitResult(Vec3.atCenterOf(targetPos), chosen.getOpposite(), targetPos, false);
|
||||
InteractionResult r = state2.use(serverLevel, player, hand, hit);
|
||||
LogUtils.getLogger().info("EAP[S]: simulated use on {}, face={}, result={}", targetPos, chosen, r);
|
||||
if (r.consumesAction()) {
|
||||
context.setPacketHandled(true);
|
||||
return;
|
||||
|
|
@ -146,9 +135,7 @@ public class CraftingMonitorJumpC2SPacket {
|
|||
}
|
||||
}
|
||||
}
|
||||
LogUtils.getLogger().info("EAP[S]: providers count for one pattern: {}", providerCount);
|
||||
}
|
||||
LogUtils.getLogger().info("EAP[S]: no target opened for key={}", msg.what);
|
||||
});
|
||||
context.setPacketHandled(true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user