1.3.1
This commit is contained in:
parent
e8341948f9
commit
cb055d6555
|
|
@ -82,14 +82,12 @@ public abstract class ContainerExPatternProviderMixin extends PatternProviderMen
|
||||||
this.maxPage = (maxSlots + SLOTS_PER_PAGE - 1) / SLOTS_PER_PAGE;
|
this.maxPage = (maxSlots + SLOTS_PER_PAGE - 1) / SLOTS_PER_PAGE;
|
||||||
|
|
||||||
// 注册通用动作(供 CGenericPacket 分发)
|
// 注册通用动作(供 CGenericPacket 分发)
|
||||||
this.actions.put("multiply2", p -> { System.out.println("[EAE+][Server] multiply2"); modifyPatterns(2, false); });
|
this.actions.put("multiply2", p -> { modifyPatterns(2, false); });
|
||||||
this.actions.put("divide2", p -> { System.out.println("[EAE+][Server] divide2"); modifyPatterns(2, true); });
|
this.actions.put("divide2", p -> { modifyPatterns(2, true); });
|
||||||
this.actions.put("multiply5", p -> { System.out.println("[EAE+][Server] multiply5"); modifyPatterns(5, false); });
|
this.actions.put("multiply5", p -> { modifyPatterns(5, false); });
|
||||||
this.actions.put("divide5", p -> { System.out.println("[EAE+][Server] divide5"); modifyPatterns(5, true); });
|
this.actions.put("divide5", p -> { modifyPatterns(5, true); });
|
||||||
this.actions.put("multiply10",p -> { System.out.println("[EAE+][Server] multiply10");modifyPatterns(10, false);});
|
this.actions.put("multiply10",p -> { modifyPatterns(10, false);});
|
||||||
this.actions.put("divide10", p -> { System.out.println("[EAE+][Server] divide10"); modifyPatterns(10, true); });
|
this.actions.put("divide10", p -> { modifyPatterns(10, true); });
|
||||||
|
|
||||||
System.out.println("[EAE+][Server] ContainerExPatternProvider actions registered: " + this.actions.keySet());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
|
|
|
||||||
|
|
@ -57,13 +57,10 @@ public abstract class ContainerExPatternTerminalMixin implements IActionHolder {
|
||||||
int playerSlotIndex = (o0 instanceof Number) ? ((Number) o0).intValue() : Integer.parseInt(String.valueOf(o0));
|
int playerSlotIndex = (o0 instanceof Number) ? ((Number) o0).intValue() : Integer.parseInt(String.valueOf(o0));
|
||||||
long providerId = (o1 instanceof Number) ? ((Number) o1).longValue() : Long.parseLong(String.valueOf(o1));
|
long providerId = (o1 instanceof Number) ? ((Number) o1).longValue() : Long.parseLong(String.valueOf(o1));
|
||||||
var sp = (ServerPlayer) this.epp$player;
|
var sp = (ServerPlayer) this.epp$player;
|
||||||
System.out.println("[EAE+][Server] upload: slot=" + playerSlotIndex + ", provider=" + providerId);
|
|
||||||
ExtendedAEPatternUploadUtil.uploadPatternToProvider(sp, playerSlotIndex, providerId);
|
ExtendedAEPatternUploadUtil.uploadPatternToProvider(sp, playerSlotIndex, providerId);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
System.out.println("[EAE+][Server] ExPatternTerminal actions registered: " + this.actions.keySet());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
||||||
|
|
@ -45,19 +45,16 @@ public abstract class ContainerPatternEncodingTermMenuMixin implements IActionHo
|
||||||
}
|
}
|
||||||
var stack = this.encodedPatternSlot != null ? this.encodedPatternSlot.getItem() : net.minecraft.world.item.ItemStack.EMPTY;
|
var stack = this.encodedPatternSlot != null ? this.encodedPatternSlot.getItem() : net.minecraft.world.item.ItemStack.EMPTY;
|
||||||
if (stack != null && !stack.isEmpty() && PatternDetailsHelper.isEncodedPattern(stack)) {
|
if (stack != null && !stack.isEmpty() && PatternDetailsHelper.isEncodedPattern(stack)) {
|
||||||
System.out.println("[EAE+][Server] Auto-upload crafting pattern after encode.");
|
|
||||||
ExtendedAEPatternUploadUtil.uploadFromEncodingMenuToMatrix(sp, menu);
|
ExtendedAEPatternUploadUtil.uploadFromEncodingMenuToMatrix(sp, menu);
|
||||||
} else {
|
} else {
|
||||||
// 槽位可能尚未同步到位,继续下一 tick 重试
|
// 槽位可能尚未同步到位,继续下一 tick 重试
|
||||||
if (attemptsLeft > 0) {
|
if (attemptsLeft > 0) {
|
||||||
epp$scheduleUploadWithRetry(sp, menu, attemptsLeft - 1);
|
epp$scheduleUploadWithRetry(sp, menu, attemptsLeft - 1);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("[EAE+][Server] Auto-upload aborted: encoded slot still empty or not encoded after retries.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
System.out.println("[EAE+][Server] Auto-upload after encode failed: " + t);
|
|
||||||
t.printStackTrace();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -108,13 +105,9 @@ public abstract class ContainerPatternEncodingTermMenuMixin implements IActionHo
|
||||||
try {
|
try {
|
||||||
ExtendedAEPatternUploadUtil.uploadFromEncodingMenuToMatrix(sp, menu);
|
ExtendedAEPatternUploadUtil.uploadFromEncodingMenuToMatrix(sp, menu);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
System.out.println("[EAE+][Server] Auto-upload after encode failed: " + t);
|
|
||||||
t.printStackTrace();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
System.out.println("[EAE+][Server] epp$serverUploadAfterEncode error: " + t);
|
|
||||||
t.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,10 @@ public abstract class ContainerUWirelessExPatternTerminalMixin implements IActio
|
||||||
int playerSlotIndex = (o0 instanceof Number) ? ((Number) o0).intValue() : Integer.parseInt(String.valueOf(o0));
|
int playerSlotIndex = (o0 instanceof Number) ? ((Number) o0).intValue() : Integer.parseInt(String.valueOf(o0));
|
||||||
long providerId = (o1 instanceof Number) ? ((Number) o1).longValue() : Long.parseLong(String.valueOf(o1));
|
long providerId = (o1 instanceof Number) ? ((Number) o1).longValue() : Long.parseLong(String.valueOf(o1));
|
||||||
var sp = (ServerPlayer) this.epp$player;
|
var sp = (ServerPlayer) this.epp$player;
|
||||||
System.out.println("[EAE+][Server][UWireless] upload: slot=" + playerSlotIndex + ", provider=" + providerId);
|
|
||||||
ExtendedAEPatternUploadUtil.uploadPatternToProvider(sp, playerSlotIndex, providerId);
|
ExtendedAEPatternUploadUtil.uploadPatternToProvider(sp, playerSlotIndex, providerId);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
System.out.println("[EAE+][Server] UWirelessExPAT actions registered: " + this.actions.keySet());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,10 @@ public abstract class ContainerWirelessExPatternTerminalMixin implements IAction
|
||||||
int playerSlotIndex = (o0 instanceof Number) ? ((Number) o0).intValue() : Integer.parseInt(String.valueOf(o0));
|
int playerSlotIndex = (o0 instanceof Number) ? ((Number) o0).intValue() : Integer.parseInt(String.valueOf(o0));
|
||||||
long providerId = (o1 instanceof Number) ? ((Number) o1).longValue() : Long.parseLong(String.valueOf(o1));
|
long providerId = (o1 instanceof Number) ? ((Number) o1).longValue() : Long.parseLong(String.valueOf(o1));
|
||||||
var sp = (ServerPlayer) this.epp$player;
|
var sp = (ServerPlayer) this.epp$player;
|
||||||
System.out.println("[EAE+][Server][Wireless] upload: slot=" + playerSlotIndex + ", provider=" + providerId);
|
|
||||||
ExtendedAEPatternUploadUtil.uploadPatternToProvider(sp, playerSlotIndex, providerId);
|
ExtendedAEPatternUploadUtil.uploadPatternToProvider(sp, playerSlotIndex, providerId);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
System.out.println("[EAE+][Server] WirelessExPAT actions registered: " + this.actions.keySet());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
||||||
|
|
@ -277,11 +277,7 @@ public abstract class GuiExPatternProviderMixin extends PatternProviderScreen<Co
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
@Inject(method = "<init>", at = @At("RETURN"))
|
||||||
private void injectInit(ContainerExPatternProvider menu, Inventory playerInventory, Component title, ScreenStyle style, CallbackInfo ci) {
|
private void injectInit(ContainerExPatternProvider menu, Inventory playerInventory, Component title, ScreenStyle style, CallbackInfo ci) {
|
||||||
this.screenStyle = style;
|
this.screenStyle = style;
|
||||||
// 打印当前菜单类型,确认是否为扩展容器
|
// 保留:不再打印菜单类型
|
||||||
try {
|
|
||||||
var m = this.getMenu();
|
|
||||||
System.out.println("[EAE+][Client] Screen menu class = " + (m == null ? "null" : m.getClass().getName()));
|
|
||||||
} catch (Throwable ignored) {}
|
|
||||||
|
|
||||||
// 翻页按钮(仅在需要时显示)
|
// 翻页按钮(仅在需要时显示)
|
||||||
int totalSlots = this.getMenu().getSlots(SlotSemantics.ENCODED_PATTERN).size();
|
int totalSlots = this.getMenu().getSlots(SlotSemantics.ENCODED_PATTERN).size();
|
||||||
|
|
@ -314,37 +310,31 @@ public abstract class GuiExPatternProviderMixin extends PatternProviderScreen<Co
|
||||||
|
|
||||||
// 倍增/除法按钮,通过 ExtendedAE 的通用包派发
|
// 倍增/除法按钮,通过 ExtendedAE 的通用包派发
|
||||||
this.x2Button = new ActionEPPButton((b) -> {
|
this.x2Button = new ActionEPPButton((b) -> {
|
||||||
System.out.println("[EAE+][Client] click multiply2");
|
|
||||||
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("multiply2"));
|
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("multiply2"));
|
||||||
}, NewIcon.MULTIPLY2);
|
}, NewIcon.MULTIPLY2);
|
||||||
this.x2Button.setVisibility(true);
|
this.x2Button.setVisibility(true);
|
||||||
|
|
||||||
this.divideBy2Button = new ActionEPPButton((b) -> {
|
this.divideBy2Button = new ActionEPPButton((b) -> {
|
||||||
System.out.println("[EAE+][Client] click divide2");
|
|
||||||
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("divide2"));
|
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("divide2"));
|
||||||
}, NewIcon.DIVIDE2);
|
}, NewIcon.DIVIDE2);
|
||||||
this.divideBy2Button.setVisibility(true);
|
this.divideBy2Button.setVisibility(true);
|
||||||
|
|
||||||
this.x10Button = new ActionEPPButton((b) -> {
|
this.x10Button = new ActionEPPButton((b) -> {
|
||||||
System.out.println("[EAE+][Client] click multiply10");
|
|
||||||
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("multiply10"));
|
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("multiply10"));
|
||||||
}, NewIcon.MULTIPLY10);
|
}, NewIcon.MULTIPLY10);
|
||||||
this.x10Button.setVisibility(true);
|
this.x10Button.setVisibility(true);
|
||||||
|
|
||||||
this.divideBy10Button = new ActionEPPButton((b) -> {
|
this.divideBy10Button = new ActionEPPButton((b) -> {
|
||||||
System.out.println("[EAE+][Client] click divide10");
|
|
||||||
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("divide10"));
|
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("divide10"));
|
||||||
}, NewIcon.DIVIDE10);
|
}, NewIcon.DIVIDE10);
|
||||||
this.divideBy10Button.setVisibility(true);
|
this.divideBy10Button.setVisibility(true);
|
||||||
|
|
||||||
this.divideBy5Button = new ActionEPPButton((b) -> {
|
this.divideBy5Button = new ActionEPPButton((b) -> {
|
||||||
System.out.println("[EAE+][Client] click divide5");
|
|
||||||
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("divide5"));
|
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("divide5"));
|
||||||
}, NewIcon.DIVIDE5);
|
}, NewIcon.DIVIDE5);
|
||||||
this.divideBy5Button.setVisibility(true);
|
this.divideBy5Button.setVisibility(true);
|
||||||
|
|
||||||
this.x5Button = new ActionEPPButton((b) -> {
|
this.x5Button = new ActionEPPButton((b) -> {
|
||||||
System.out.println("[EAE+][Client] click multiply5");
|
|
||||||
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("multiply5"));
|
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("multiply5"));
|
||||||
}, NewIcon.MULTIPLY5);
|
}, NewIcon.MULTIPLY5);
|
||||||
this.x5Button.setVisibility(true);
|
this.x5Button.setVisibility(true);
|
||||||
|
|
@ -371,7 +361,6 @@ public abstract class GuiExPatternProviderMixin extends PatternProviderScreen<Co
|
||||||
try {
|
try {
|
||||||
// 直接基于容器槽位操作,完全绕开 PatternProviderLogic 及其内部字段
|
// 直接基于容器槽位操作,完全绕开 PatternProviderLogic 及其内部字段
|
||||||
if (!(serverPlayer.containerMenu instanceof com.glodblock.github.extendedae.container.ContainerExPatternProvider exMenu)) {
|
if (!(serverPlayer.containerMenu instanceof com.glodblock.github.extendedae.container.ContainerExPatternProvider exMenu)) {
|
||||||
System.out.println("ExtendedAE Plus: 当前容器不是 ExPatternProvider,无法执行样板缩放");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -430,17 +419,12 @@ public abstract class GuiExPatternProviderMixin extends PatternProviderScreen<Co
|
||||||
if (minecraft.player != null) {
|
if (minecraft.player != null) {
|
||||||
minecraft.player.displayClientMessage(net.minecraft.network.chat.Component.literal(message), true);
|
minecraft.player.displayClientMessage(net.minecraft.network.chat.Component.literal(message), true);
|
||||||
}
|
}
|
||||||
System.out.println("ExtendedAE Plus: " + message);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("ExtendedAE Plus: 服务器端执行样板缩放时发生错误: " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("ExtendedAE Plus: 调度到服务器主线程时发生错误: " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,6 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<ContainerEx
|
||||||
if (!itemToUpload.isEmpty() && PatternDetailsHelper.isEncodedPattern(itemToUpload)) {
|
if (!itemToUpload.isEmpty() && PatternDetailsHelper.isEncodedPattern(itemToUpload)) {
|
||||||
// 通过 ExtendedAE 内置网络系统发送通用动作到服务端
|
// 通过 ExtendedAE 内置网络系统发送通用动作到服务端
|
||||||
// 动作: "upload",参数: 槽位索引(int)、供应器ID(long)
|
// 动作: "upload",参数: 槽位索引(int)、供应器ID(long)
|
||||||
System.out.println("[EAE+][Client] send upload: slot=" + playerSlotIndex + ", provider=" + currentlychooicepatterprovider);
|
|
||||||
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("upload", playerSlotIndex, currentlychooicepatterprovider));
|
EPPNetworkHandler.INSTANCE.sendToServer(new CGenericPacket("upload", playerSlotIndex, currentlychooicepatterprovider));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -137,9 +136,7 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<ContainerEx
|
||||||
private void injectConstructor(ContainerExPatternTerminal menu, Inventory playerInventory, Component title, ScreenStyle style, CallbackInfo ci) {
|
private void injectConstructor(ContainerExPatternTerminal menu, Inventory playerInventory, Component title, ScreenStyle style, CallbackInfo ci) {
|
||||||
// 创建切换槽位显示的按钮
|
// 创建切换槽位显示的按钮
|
||||||
this.toggleSlotsButton = new IconButton((b) -> {
|
this.toggleSlotsButton = new IconButton((b) -> {
|
||||||
System.out.println("ExtendedAE Plus: 按钮被点击,当前showSlots: " + this.showSlots);
|
|
||||||
this.showSlots = !this.showSlots; // 开关状态
|
this.showSlots = !this.showSlots; // 开关状态
|
||||||
System.out.println("ExtendedAE Plus: 切换后showSlots: " + this.showSlots);
|
|
||||||
|
|
||||||
// 通过反射调用refreshList方法 - 先尝试当前类,失败后尝试父类
|
// 通过反射调用refreshList方法 - 先尝试当前类,失败后尝试父类
|
||||||
try {
|
try {
|
||||||
|
|
@ -147,24 +144,18 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<ContainerEx
|
||||||
try {
|
try {
|
||||||
// 先尝试在当前类中查找
|
// 先尝试在当前类中查找
|
||||||
refreshMethod = this.getClass().getDeclaredMethod("refreshList");
|
refreshMethod = this.getClass().getDeclaredMethod("refreshList");
|
||||||
System.out.println("ExtendedAE Plus: 在当前类中找到refreshList方法: " + this.getClass().getSimpleName());
|
|
||||||
} catch (NoSuchMethodException e1) {
|
} catch (NoSuchMethodException e1) {
|
||||||
// 如果当前类没有,尝试在父类中查找
|
// 如果当前类没有,尝试在父类中查找
|
||||||
try {
|
try {
|
||||||
refreshMethod = this.getClass().getSuperclass().getDeclaredMethod("refreshList");
|
refreshMethod = this.getClass().getSuperclass().getDeclaredMethod("refreshList");
|
||||||
System.out.println("ExtendedAE Plus: 在父类中找到refreshList方法: " + this.getClass().getSuperclass().getSimpleName());
|
|
||||||
} catch (NoSuchMethodException e2) {
|
} catch (NoSuchMethodException e2) {
|
||||||
System.out.println("ExtendedAE Plus: 在当前类和父类中都找不到refreshList方法");
|
|
||||||
throw e2;
|
throw e2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshMethod.setAccessible(true);
|
refreshMethod.setAccessible(true);
|
||||||
refreshMethod.invoke(this);
|
refreshMethod.invoke(this);
|
||||||
System.out.println("ExtendedAE Plus: refreshList调用成功");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("ExtendedAE Plus: 调用refreshList失败: " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -178,13 +169,10 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<ContainerEx
|
||||||
|
|
||||||
// 添加到左侧工具栏
|
// 添加到左侧工具栏
|
||||||
this.addToLeftToolbar(this.toggleSlotsButton);
|
this.addToLeftToolbar(this.toggleSlotsButton);
|
||||||
|
|
||||||
System.out.println("ExtendedAE Plus: 槽位切换按钮已添加到工具栏,默认显示模式: " + this.showSlots);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "refreshList", at = @At("HEAD"), remap = false)
|
@Inject(method = "refreshList", at = @At("HEAD"), remap = false)
|
||||||
private void onRefreshListStart(CallbackInfo ci) {
|
private void onRefreshListStart(CallbackInfo ci) {
|
||||||
System.out.println("ExtendedAE Plus: refreshList开始执行 - 显示槽位: " + this.showSlots);
|
|
||||||
|
|
||||||
// 更新按钮图标
|
// 更新按钮图标
|
||||||
if (this.toggleSlotsButton != null) {
|
if (this.toggleSlotsButton != null) {
|
||||||
|
|
@ -196,7 +184,6 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<ContainerEx
|
||||||
|
|
||||||
@Inject(method = "refreshList", at = @At("TAIL"), remap = false)
|
@Inject(method = "refreshList", at = @At("TAIL"), remap = false)
|
||||||
private void onRefreshListEnd(CallbackInfo ci) {
|
private void onRefreshListEnd(CallbackInfo ci) {
|
||||||
System.out.println("ExtendedAE Plus: refreshList结束 - showSlots状态: " + this.showSlots);
|
|
||||||
|
|
||||||
// 在refreshList结束后,根据showSlots状态过滤SlotsRow
|
// 在refreshList结束后,根据showSlots状态过滤SlotsRow
|
||||||
if (!this.showSlots) {
|
if (!this.showSlots) {
|
||||||
|
|
@ -206,35 +193,27 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<ContainerEx
|
||||||
try {
|
try {
|
||||||
// 先尝试在当前类中查找
|
// 先尝试在当前类中查找
|
||||||
rowsField = this.getClass().getDeclaredField("rows");
|
rowsField = this.getClass().getDeclaredField("rows");
|
||||||
System.out.println("ExtendedAE Plus: 在当前类中找到rows字段: " + this.getClass().getSimpleName());
|
|
||||||
} catch (NoSuchFieldException e1) {
|
} catch (NoSuchFieldException e1) {
|
||||||
// 如果当前类没有,尝试在父类中查找
|
// 如果当前类没有,尝试在父类中查找
|
||||||
try {
|
try {
|
||||||
rowsField = this.getClass().getSuperclass().getDeclaredField("rows");
|
rowsField = this.getClass().getSuperclass().getDeclaredField("rows");
|
||||||
System.out.println("ExtendedAE Plus: 在父类中找到rows字段: " + this.getClass().getSuperclass().getSimpleName());
|
|
||||||
} catch (NoSuchFieldException e2) {
|
} catch (NoSuchFieldException e2) {
|
||||||
System.out.println("ExtendedAE Plus: 在当前类和父类中都找不到rows字段");
|
|
||||||
throw e2;
|
throw e2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rowsField.setAccessible(true);
|
rowsField.setAccessible(true);
|
||||||
java.util.ArrayList<?> rows = (java.util.ArrayList<?>) rowsField.get(this);
|
java.util.ArrayList<?> rows = (java.util.ArrayList<?>) rowsField.get(this);
|
||||||
|
|
||||||
System.out.println("ExtendedAE Plus: 找到rows字段,当前行数: " + rows.size());
|
|
||||||
|
|
||||||
// 通过反射访问highlightBtns字段
|
// 通过反射访问highlightBtns字段
|
||||||
java.lang.reflect.Field highlightBtnsField = null;
|
java.lang.reflect.Field highlightBtnsField = null;
|
||||||
try {
|
try {
|
||||||
// 先尝试在当前类中查找
|
// 先尝试在当前类中查找
|
||||||
highlightBtnsField = this.getClass().getDeclaredField("highlightBtns");
|
highlightBtnsField = this.getClass().getDeclaredField("highlightBtns");
|
||||||
System.out.println("ExtendedAE Plus: 在当前类中找到highlightBtns字段: " + this.getClass().getSimpleName());
|
|
||||||
} catch (NoSuchFieldException e1) {
|
} catch (NoSuchFieldException e1) {
|
||||||
// 如果当前类没有,尝试在父类中查找
|
// 如果当前类没有,尝试在父类中查找
|
||||||
try {
|
try {
|
||||||
highlightBtnsField = this.getClass().getSuperclass().getDeclaredField("highlightBtns");
|
highlightBtnsField = this.getClass().getSuperclass().getDeclaredField("highlightBtns");
|
||||||
System.out.println("ExtendedAE Plus: 在父类中找到highlightBtns字段: " + this.getClass().getSuperclass().getSimpleName());
|
|
||||||
} catch (NoSuchFieldException e2) {
|
} catch (NoSuchFieldException e2) {
|
||||||
System.out.println("ExtendedAE Plus: 在当前类和父类中都找不到highlightBtns字段");
|
|
||||||
throw e2;
|
throw e2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -242,8 +221,6 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<ContainerEx
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
java.util.HashMap<Integer, Object> highlightBtns = (java.util.HashMap<Integer, Object>) highlightBtnsField.get(this);
|
java.util.HashMap<Integer, Object> highlightBtns = (java.util.HashMap<Integer, Object>) highlightBtnsField.get(this);
|
||||||
|
|
||||||
System.out.println("ExtendedAE Plus: 找到highlightBtns字段,当前按钮数: " + highlightBtns.size());
|
|
||||||
|
|
||||||
// 创建新的索引映射
|
// 创建新的索引映射
|
||||||
java.util.HashMap<Integer, Object> newHighlightBtns = new java.util.HashMap<>();
|
java.util.HashMap<Integer, Object> newHighlightBtns = new java.util.HashMap<>();
|
||||||
int newIndex = 0;
|
int newIndex = 0;
|
||||||
|
|
@ -252,7 +229,6 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<ContainerEx
|
||||||
for (int i = 0; i < rows.size(); i++) {
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
Object row = rows.get(i);
|
Object row = rows.get(i);
|
||||||
String className = row.getClass().getSimpleName();
|
String className = row.getClass().getSimpleName();
|
||||||
System.out.println("ExtendedAE Plus: 检查行 " + i + ",类型: " + className);
|
|
||||||
|
|
||||||
if (className.equals("GroupHeaderRow")) {
|
if (className.equals("GroupHeaderRow")) {
|
||||||
// 保留GroupHeaderRow,并重新映射对应的高亮按钮
|
// 保留GroupHeaderRow,并重新映射对应的高亮按钮
|
||||||
|
|
@ -267,22 +243,14 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<ContainerEx
|
||||||
if (highlightBtns.containsKey(i + 1)) {
|
if (highlightBtns.containsKey(i + 1)) {
|
||||||
Object button = highlightBtns.get(i + 1);
|
Object button = highlightBtns.get(i + 1);
|
||||||
newHighlightBtns.put(newIndex, button);
|
newHighlightBtns.put(newIndex, button);
|
||||||
System.out.println("ExtendedAE Plus: 重新映射高亮按钮,从索引 " + (i + 1) + " 到 " + newIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newIndex++;
|
newIndex++;
|
||||||
} else if (className.equals("SlotsRow")) {
|
} else if (className.equals("SlotsRow")) {
|
||||||
System.out.println("ExtendedAE Plus: 移除行 " + i);
|
|
||||||
// 不保留SlotsRow,也不增加newIndex
|
// 不保留SlotsRow,也不增加newIndex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打印所有原始的高亮按钮索引,帮助调试
|
|
||||||
System.out.println("ExtendedAE Plus: 原始高亮按钮索引:");
|
|
||||||
for (java.util.Map.Entry<Integer, Object> entry : highlightBtns.entrySet()) {
|
|
||||||
System.out.println("ExtendedAE Plus: 索引 " + entry.getKey() + " -> 按钮对象: " + entry.getValue().getClass().getSimpleName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 移除多余的行
|
// 移除多余的行
|
||||||
while (rows.size() > newIndex) {
|
while (rows.size() > newIndex) {
|
||||||
rows.remove(rows.size() - 1);
|
rows.remove(rows.size() - 1);
|
||||||
|
|
@ -292,43 +260,28 @@ public abstract class GuiExPatternTerminalMixin extends AEBaseScreen<ContainerEx
|
||||||
highlightBtns.clear();
|
highlightBtns.clear();
|
||||||
highlightBtns.putAll(newHighlightBtns);
|
highlightBtns.putAll(newHighlightBtns);
|
||||||
|
|
||||||
System.out.println("ExtendedAE Plus: 已隐藏槽位行,剩余行数: " + rows.size() + ",重新映射的高亮按钮数: " + newHighlightBtns.size());
|
|
||||||
|
|
||||||
// 打印所有重新映射的按钮索引
|
|
||||||
for (java.util.Map.Entry<Integer, Object> entry : newHighlightBtns.entrySet()) {
|
|
||||||
System.out.println("ExtendedAE Plus: 高亮按钮映射 - 索引 " + entry.getKey() + " -> 按钮对象: " + entry.getValue().getClass().getSimpleName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 强制刷新滚动条
|
// 强制刷新滚动条
|
||||||
try {
|
try {
|
||||||
java.lang.reflect.Method resetScrollbarMethod = null;
|
java.lang.reflect.Method resetScrollbarMethod = null;
|
||||||
try {
|
try {
|
||||||
// 先尝试在当前类中查找
|
// 先尝试在当前类中查找
|
||||||
resetScrollbarMethod = this.getClass().getDeclaredMethod("resetScrollbar");
|
resetScrollbarMethod = this.getClass().getDeclaredMethod("resetScrollbar");
|
||||||
System.out.println("ExtendedAE Plus: 在当前类中找到resetScrollbar方法: " + this.getClass().getSimpleName());
|
|
||||||
} catch (NoSuchMethodException e1) {
|
} catch (NoSuchMethodException e1) {
|
||||||
// 如果当前类没有,尝试在父类中查找
|
// 如果当前类没有,尝试在父类中查找
|
||||||
try {
|
try {
|
||||||
resetScrollbarMethod = this.getClass().getSuperclass().getDeclaredMethod("resetScrollbar");
|
resetScrollbarMethod = this.getClass().getSuperclass().getDeclaredMethod("resetScrollbar");
|
||||||
System.out.println("ExtendedAE Plus: 在父类中找到resetScrollbar方法: " + this.getClass().getSuperclass().getSimpleName());
|
|
||||||
} catch (NoSuchMethodException e2) {
|
} catch (NoSuchMethodException e2) {
|
||||||
System.out.println("ExtendedAE Plus: 在当前类和父类中都找不到resetScrollbar方法");
|
|
||||||
throw e2;
|
throw e2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resetScrollbarMethod.setAccessible(true);
|
resetScrollbarMethod.setAccessible(true);
|
||||||
resetScrollbarMethod.invoke(this);
|
resetScrollbarMethod.invoke(this);
|
||||||
System.out.println("ExtendedAE Plus: 滚动条已重置");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("ExtendedAE Plus: 重置滚动条失败: " + e.getMessage());
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("ExtendedAE Plus: 访问字段失败: " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println("ExtendedAE Plus: showSlots为true,不隐藏槽位行");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -49,18 +49,13 @@ public abstract class HighlightButtonMixin {
|
||||||
try {
|
try {
|
||||||
var setMethod = terminal.getClass().getMethod("setCurrentlyChoicePatternProvider", long.class);
|
var setMethod = terminal.getClass().getMethod("setCurrentlyChoicePatternProvider", long.class);
|
||||||
setMethod.invoke(terminal, serverId);
|
setMethod.invoke(terminal, serverId);
|
||||||
System.out.println("ExtendedAE Plus: 通过Mixin设置了当前选择的样板供应器ID: " + serverId);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("ExtendedAE Plus: 无法设置样板供应器ID,错误: " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("ExtendedAE Plus: 通过Mixin设置样板供应器ID时出错: " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ public class ProvidersListS2CPacket {
|
||||||
private static void handleClient(ProvidersListS2CPacket msg) {
|
private static void handleClient(ProvidersListS2CPacket msg) {
|
||||||
var mc = Minecraft.getInstance();
|
var mc = Minecraft.getInstance();
|
||||||
if (mc == null) return;
|
if (mc == null) return;
|
||||||
System.out.println("[EAE+][Client] ProvidersListS2C received, size=" + msg.ids.size());
|
|
||||||
var current = mc.screen;
|
var current = mc.screen;
|
||||||
mc.setScreen(new ProviderSelectScreen(current, msg.ids, msg.names, msg.emptySlots));
|
mc.setScreen(new ProviderSelectScreen(current, msg.ids, msg.names, msg.emptySlots));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ public class RequestProvidersListC2SPacket {
|
||||||
ServerPlayer player = ctx.getSender();
|
ServerPlayer player = ctx.getSender();
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
if (!(player.containerMenu instanceof PatternEncodingTermMenu encMenu)) return;
|
if (!(player.containerMenu instanceof PatternEncodingTermMenu encMenu)) return;
|
||||||
System.out.println("[EAE+][Server] RequestProvidersListC2S from " + player.getGameProfile().getName());
|
|
||||||
|
|
||||||
// 优先:若玩家也打开了样板访问终端,则用 byId 方式(精确服务器ID)
|
// 优先:若玩家也打开了样板访问终端,则用 byId 方式(精确服务器ID)
|
||||||
PatternAccessTermMenu accessMenu = ExtendedAEPatternUploadUtil.getPatternAccessMenu(player);
|
PatternAccessTermMenu accessMenu = ExtendedAEPatternUploadUtil.getPatternAccessMenu(player);
|
||||||
|
|
@ -49,7 +48,6 @@ public class RequestProvidersListC2SPacket {
|
||||||
slots.add(empty);
|
slots.add(empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("[EAE+][Server] Providers via accessMenu: size=" + filteredIds.size());
|
|
||||||
ModNetwork.CHANNEL.sendTo(new ProvidersListS2CPacket(filteredIds, names, slots), player.connection.connection, net.minecraftforge.network.NetworkDirection.PLAY_TO_CLIENT);
|
ModNetwork.CHANNEL.sendTo(new ProvidersListS2CPacket(filteredIds, names, slots), player.connection.connection, net.minecraftforge.network.NetworkDirection.PLAY_TO_CLIENT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +67,6 @@ public class RequestProvidersListC2SPacket {
|
||||||
names.add(ExtendedAEPatternUploadUtil.getProviderDisplayName(c));
|
names.add(ExtendedAEPatternUploadUtil.getProviderDisplayName(c));
|
||||||
slots.add(empty);
|
slots.add(empty);
|
||||||
}
|
}
|
||||||
System.out.println("[EAE+][Server] Providers via grid-fallback: size=" + idxIds.size());
|
|
||||||
ModNetwork.CHANNEL.sendTo(new ProvidersListS2CPacket(idxIds, names, slots), player.connection.connection, net.minecraftforge.network.NetworkDirection.PLAY_TO_CLIENT);
|
ModNetwork.CHANNEL.sendTo(new ProvidersListS2CPacket(idxIds, names, slots), player.connection.connection, net.minecraftforge.network.NetworkDirection.PLAY_TO_CLIENT);
|
||||||
});
|
});
|
||||||
ctx.setPacketHandled(true);
|
ctx.setPacketHandled(true);
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,6 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
*/
|
*/
|
||||||
public static boolean uploadFromEncodingMenuToMatrix(ServerPlayer player, PatternEncodingTermMenu menu) {
|
public static boolean uploadFromEncodingMenuToMatrix(ServerPlayer player, PatternEncodingTermMenu menu) {
|
||||||
if (player == null || menu == null) {
|
if (player == null || menu == null) {
|
||||||
System.out.println("[EAE+][Server] uploadFromEncodingMenuToMatrix: player or menu is null");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -343,35 +342,27 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
var encodedSlot = ((com.extendedae_plus.mixin.accessor.PatternEncodingTermMenuAccessor) (Object) menu)
|
var encodedSlot = ((com.extendedae_plus.mixin.accessor.PatternEncodingTermMenuAccessor) (Object) menu)
|
||||||
.epp$getEncodedPatternSlot();
|
.epp$getEncodedPatternSlot();
|
||||||
ItemStack stack = encodedSlot.getItem();
|
ItemStack stack = encodedSlot.getItem();
|
||||||
System.out.println("[EAE+][Server] Encoded slot stack: " + stack + ", count=" + stack.getCount());
|
|
||||||
if (stack.isEmpty() || !PatternDetailsHelper.isEncodedPattern(stack)) {
|
if (stack.isEmpty() || !PatternDetailsHelper.isEncodedPattern(stack)) {
|
||||||
sendMessage(player, "ExtendedAE Plus: 没有可上传的编码样板");
|
sendMessage(player, "ExtendedAE Plus: 没有可上传的编码样板");
|
||||||
System.out.println("[EAE+][Server] Fail: stack empty or not encoded pattern");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 仅允许“合成图样”
|
// 仅允许“合成图样”
|
||||||
IPatternDetails details = PatternDetailsHelper.decodePattern(stack, player.level());
|
IPatternDetails details = PatternDetailsHelper.decodePattern(stack, player.level());
|
||||||
System.out.println("[EAE+][Server] Decoded details: " + (details == null ? "null" : details.getClass().getName()));
|
|
||||||
if (!(details instanceof AECraftingPattern)) {
|
if (!(details instanceof AECraftingPattern)) {
|
||||||
sendMessage(player, "extendedae_plus.upload_to_matrix.fail_not_crafting");
|
sendMessage(player, "extendedae_plus.upload_to_matrix.fail_not_crafting");
|
||||||
System.out.println("[EAE+][Server] Fail: not AECraftingPattern");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取 AE 网络
|
// 获取 AE 网络
|
||||||
IGridNode node = menu.getNetworkNode();
|
IGridNode node = menu.getNetworkNode();
|
||||||
System.out.println("[EAE+][Server] Grid node: " + node);
|
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
sendMessage(player, "ExtendedAE Plus: 当前不在有效的 AE 网络中");
|
sendMessage(player, "ExtendedAE Plus: 当前不在有效的 AE 网络中");
|
||||||
System.out.println("[EAE+][Server] Fail: grid node null");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
IGrid grid = node.getGrid();
|
IGrid grid = node.getGrid();
|
||||||
System.out.println("[EAE+][Server] Grid: " + grid);
|
|
||||||
if (grid == null) {
|
if (grid == null) {
|
||||||
sendMessage(player, "ExtendedAE Plus: 当前不在有效的 AE 网络中");
|
sendMessage(player, "ExtendedAE Plus: 当前不在有效的 AE 网络中");
|
||||||
System.out.println("[EAE+][Server] Fail: grid null");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -394,7 +385,6 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
player.getInventory().placeItemBackInInventory(blanks, false);
|
player.getInventory().placeItemBackInInventory(blanks, false);
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
System.out.println("[EAE+][Server] Failed to return blank patterns: " + t);
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
// 兜底:直接还给玩家背包
|
// 兜底:直接还给玩家背包
|
||||||
player.getInventory().placeItemBackInInventory(AEItems.BLANK_PATTERN.stack(stack.getCount()), false);
|
player.getInventory().placeItemBackInInventory(AEItems.BLANK_PATTERN.stack(stack.getCount()), false);
|
||||||
|
|
@ -402,20 +392,16 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
}
|
}
|
||||||
// 清空编码样板槽,防止再次输出
|
// 清空编码样板槽,防止再次输出
|
||||||
encodedSlot.set(ItemStack.EMPTY);
|
encodedSlot.set(ItemStack.EMPTY);
|
||||||
System.out.println("[EAE+][Server] Skip: duplicate pattern already present in matrix, returned blanks and cleared encoded slot");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收集所有可用的装配矩阵(图样模块)内部库存并逐一尝试(遵循其过滤规则)
|
// 收集所有可用的装配矩阵(图样模块)内部库存并逐一尝试(遵循其过滤规则)
|
||||||
List<InternalInventory> inventories = findAllMatrixPatternInventories(grid);
|
List<InternalInventory> inventories = findAllMatrixPatternInventories(grid);
|
||||||
System.out.println("[EAE+][Server] Matrix internal inventories count: " + inventories.size());
|
|
||||||
if (!inventories.isEmpty()) {
|
if (!inventories.isEmpty()) {
|
||||||
for (int i = 0; i < inventories.size(); i++) {
|
for (int i = 0; i < inventories.size(); i++) {
|
||||||
var inv = inventories.get(i);
|
var inv = inventories.get(i);
|
||||||
ItemStack toInsert = stack.copy();
|
ItemStack toInsert = stack.copy();
|
||||||
System.out.println("[EAE+][Server] Try insert via internal inventory[" + i + "], count=" + toInsert.getCount());
|
|
||||||
ItemStack remain = inv.addItems(toInsert);
|
ItemStack remain = inv.addItems(toInsert);
|
||||||
System.out.println("[EAE+][Server] Internal inventory[" + i + "] remain count=" + remain.getCount());
|
|
||||||
if (remain.getCount() < stack.getCount()) {
|
if (remain.getCount() < stack.getCount()) {
|
||||||
int inserted = stack.getCount() - remain.getCount();
|
int inserted = stack.getCount() - remain.getCount();
|
||||||
stack.shrink(inserted);
|
stack.shrink(inserted);
|
||||||
|
|
@ -423,24 +409,19 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
encodedSlot.set(ItemStack.EMPTY);
|
encodedSlot.set(ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
sendMessage(player, "extendedae_plus.upload_to_matrix.success");
|
sendMessage(player, "extendedae_plus.upload_to_matrix.success");
|
||||||
System.out.println("[EAE+][Server] Success via internal inventory[" + i + "]: inserted=" + inserted);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 所有内部库存都无法接收
|
// 所有内部库存都无法接收 -> 尝试 capability 回退
|
||||||
System.out.println("[EAE+][Server] All internal inventories refused or full. Trying capability fallback.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 回退:尝试 Forge 能力(可能为聚合图样仓),同样遍历所有矩阵
|
// 回退:尝试 Forge 能力(可能为聚合图样仓),同样遍历所有矩阵
|
||||||
List<IItemHandler> handlers = findAllMatrixPatternHandlers(grid);
|
List<IItemHandler> handlers = findAllMatrixPatternHandlers(grid);
|
||||||
System.out.println("[EAE+][Server] Fallback Matrix item handlers count: " + handlers.size());
|
|
||||||
if (!handlers.isEmpty()) {
|
if (!handlers.isEmpty()) {
|
||||||
for (int i = 0; i < handlers.size(); i++) {
|
for (int i = 0; i < handlers.size(); i++) {
|
||||||
var cap = handlers.get(i);
|
var cap = handlers.get(i);
|
||||||
ItemStack toInsert = stack.copy();
|
ItemStack toInsert = stack.copy();
|
||||||
System.out.println("[EAE+][Server] Try insert via capability[" + i + "], count=" + toInsert.getCount());
|
|
||||||
ItemStack remain = insertIntoAnySlot(cap, toInsert);
|
ItemStack remain = insertIntoAnySlot(cap, toInsert);
|
||||||
System.out.println("[EAE+][Server] Capability[" + i + "] remain count=" + remain.getCount());
|
|
||||||
if (remain.getCount() < stack.getCount()) {
|
if (remain.getCount() < stack.getCount()) {
|
||||||
int inserted = stack.getCount() - remain.getCount();
|
int inserted = stack.getCount() - remain.getCount();
|
||||||
stack.shrink(inserted);
|
stack.shrink(inserted);
|
||||||
|
|
@ -448,7 +429,6 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
encodedSlot.set(ItemStack.EMPTY);
|
encodedSlot.set(ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
sendMessage(player, "extendedae_plus.upload_to_matrix.success");
|
sendMessage(player, "extendedae_plus.upload_to_matrix.success");
|
||||||
System.out.println("[EAE+][Server] Success via capability[" + i + "]: inserted=" + inserted);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -457,10 +437,8 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
// 未找到可用矩阵或全部拒收
|
// 未找到可用矩阵或全部拒收
|
||||||
if (inventories.isEmpty() && handlers.isEmpty()) {
|
if (inventories.isEmpty() && handlers.isEmpty()) {
|
||||||
sendMessage(player, "extendedae_plus.upload_to_matrix.fail_no_matrix");
|
sendMessage(player, "extendedae_plus.upload_to_matrix.fail_no_matrix");
|
||||||
System.out.println("[EAE+][Server] Fail: no formed matrix found");
|
|
||||||
} else {
|
} else {
|
||||||
sendMessage(player, "extendedae_plus.upload_to_matrix.fail_full");
|
sendMessage(player, "extendedae_plus.upload_to_matrix.fail_full");
|
||||||
System.out.println("[EAE+][Server] Fail: all matrices full or cannot accept pattern");
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -479,13 +457,11 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
var inv = tile.getExposedInventory();
|
var inv = tile.getExposedInventory();
|
||||||
if (inv != null) {
|
if (inv != null) {
|
||||||
result.add(inv);
|
result.add(inv);
|
||||||
System.out.println("[EAE+][Server] Found matrix internal inventory at index " + idx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
System.out.println("[EAE+][Server] findAllMatrixPatternInventories exception: " + t);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -505,7 +481,6 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
var handler = capOpt.orElse(null);
|
var handler = capOpt.orElse(null);
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
result.add(handler);
|
result.add(handler);
|
||||||
System.out.println("[EAE+][Server] Found matrix capability handler at index " + idx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -547,7 +522,6 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
System.out.println("[EAE+][Server] matrixContainsPattern (InternalInventory) exception: " + t);
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// 再检查聚合能力视图
|
// 再检查聚合能力视图
|
||||||
|
|
@ -563,7 +537,6 @@ public class ExtendedAEPatternUploadUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
System.out.println("[EAE+][Server] matrixContainsPattern (Capability) exception: " + t);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -902,13 +902,11 @@ public class PatternProviderDataUtil {
|
||||||
}
|
}
|
||||||
} catch (Exception syncException) {
|
} catch (Exception syncException) {
|
||||||
// 网络同步失败不影响主要功能
|
// 网络同步失败不影响主要功能
|
||||||
System.out.println("ExtendedAE Plus: 网络同步失败,但数据已保存: " + syncException.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 如果反射失败,使用备用方案
|
// 如果反射失败,使用备用方案
|
||||||
System.out.println("ExtendedAE Plus: 无法通过反射标记脏数据,使用备用方案: " + e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 强制更新样板缓存
|
// 3. 强制更新样板缓存
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user