Skip to content

Commit 20a6cef

Browse files
fix code 2
1 parent d9f2038 commit 20a6cef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2686
-1884
lines changed

build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ base {
2525
archivesName = mod_id
2626
}
2727

28-
// Mojang ships Java 17 to end users in 1.20.1, so mods should target Java 17.
29-
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
28+
java {
29+
toolchain {
30+
languageVersion = JavaLanguageVersion.of(21)
31+
}
32+
}
3033

3134
legacyForge {
3235
// Specify the version of MinecraftForge to use.
@@ -127,6 +130,9 @@ dependencies {
127130
implementation files("libs/ldlib-forge-1.20.1-1.0.48.jar")
128131
implementation files("libs/architectury-9.2.14-forge.jar")
129132
implementation files("libs/lombok.jar")
133+
implementation files("libs/emi-1.1.22+1.20.1+forge.jar")
134+
implementation files("libs/ExtendedAE-1.20-1.4.11-forge.jar")
135+
130136
}
131137
// Uncomment the lines below if you wish to configure mixin. The mixin file should be named modid.mixins.json.
132138
/*
2.68 MB
Binary file not shown.

libs/emi-1.1.22+1.20.1+forge.jar

1020 KB
Binary file not shown.

src/main/java/com/gtolib/AE2PatternContentPanel.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ private IExtendedPatternEncodingMenu getMenu() {
7878
public void initialize(String id, WidgetContainer container) {
7979
// 1. 设置按钮位置与回调
8080
this.clearButton.setHalfSize(true);
81-
container.addWidget(this.clearButton);
81+
container.getWidgets(this.clearButton);
8282

8383
this.cycleButton.setHalfSize(true);
84-
container.addWidget(this.cycleButton);
84+
container.getWidgets(this.cycleButton);
8585

8686
// 2. 配置滚动条逻辑
8787
this.scrollbar.setHeight(PANEL_HEIGHT);
88-
container.addWidget(this.scrollbar);
88+
container.getWidgets(this.scrollbar);
8989

9090
// 3. 配置槽位渲染
91-
container.addWidget(this.slotWidget);
91+
container.getWidgets(this.slotWidget);
9292
}
9393

9494
@Override
@@ -115,8 +115,8 @@ public Rect2i getBounds() {
115115
public void updateBeforeRender() {
116116
IExtendedPatternEncodingMenu menu = getMenu();
117117
// 根据菜单状态启用/禁用按钮
118-
this.cycleButton.setActive(menu.canCycleProcessingOutputs());
119-
this.clearButton.setActive(!menu.isSubstitute());
118+
this.cycleButton.isActive(menu.canCycleProcessingOutputs());
119+
this.clearButton.isActive(!menu.isSubstitute());
120120

121121
// 更新滚动条位置
122122
float scrollPos = this.scrollbar.getCurrentScroll();
@@ -128,11 +128,11 @@ public void updateBeforeRender() {
128128
*/
129129
public void drawBackgroundLayer(GuiGraphics graphics, Rect2i bounds, Point mousePos) {
130130
// 绘制面板背景框
131-
BACKGROUND_BLITTER.dest(bounds.getX(), bounds.getY()).draw(graphics);
131+
BACKGROUND_BLITTER.dest(bounds.getX(), bounds.getY()).src(graphics);
132132

133133
// 如果有滚动条,绘制滚动条轨道
134134
if (this.scrollbar.isVisible()) {
135-
OVERLAY_BLITTER.dest(bounds.getX() + SCROLLBAR_X, bounds.getY() + SCROLLBAR_Y).draw(graphics);
135+
OVERLAY_BLITTER.dest(bounds.getX() + SCROLLBAR_X, bounds.getY() + SCROLLBAR_Y).src(graphics);
136136
}
137137
}
138138

src/main/java/com/gtolib/AECalculationHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public AECalculationHandler() {
1616
}
1717

1818
@Override
19-
public void processCalculation(AECalculationData data) {
19+
public <AECalculationData> void processCalculation(AECalculationData data) {
2020
// 这里可以实现 AE 计算的具体操作,数据处理逻辑等
2121
// 例如:调用其它方法或者计算过程
2222
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.gtolib;
2+
3+
/**
4+
* Placeholder class representing input data for AEKey processing.
5+
*/
6+
public class AEData {
7+
// You can add fields or methods later as needed
8+
}

src/main/java/com/gtolib/AEKeyActionHandler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public AEKeyActionHandler() {
2121
* @return 如果允许操作则返回 true
2222
*/
2323
@Override
24-
protected boolean test(GtoContext context, AEKey key) {
24+
protected <GtoContext> boolean test(GtoContext context, AEKey key) {
2525
if (context == null || key == null) return false;
2626

2727
// 逻辑推断:
@@ -39,7 +39,7 @@ protected boolean test(GtoContext context, AEKey key) {
3939
* @param amount 操作的数量
4040
*/
4141
@Override
42-
protected void apply(GtoContext context, AEKey key, long amount) {
42+
protected <GtoContext> void apply(GtoContext context, AEKey key, long amount) {
4343
if (context == null || key == null) return;
4444

4545
// 逻辑推断:
@@ -51,15 +51,15 @@ protected void apply(GtoContext context, AEKey key, long amount) {
5151
/**
5252
* 模拟原本隐藏在 native 中的验证行为
5353
*/
54-
private boolean performValidation(GtoContext context, AEKey key) {
54+
private <GtoContext> boolean performValidation(GtoContext context, AEKey key) {
5555
// 示例:检查是否为处理样板模式
5656
return true;
5757
}
5858

5959
/**
6060
* 模拟原本隐藏在 native 中的执行行为
6161
*/
62-
private void performUpdate(GtoContext context, AEKey key, long amount) {
62+
private <GtoContext> void performUpdate(GtoContext context, AEKey key, long amount) {
6363
// 示例:向样板槽位添加指定数量的物品
6464
}
6565
}

src/main/java/com/gtolib/AEKeyConfigHandler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public AEKeyConfigHandler() {
2121
* @return 如果允许放置则返回 true
2222
*/
2323
@Override
24-
protected boolean test(GtoContext context, AEKey key) {
24+
protected <GtoContext> boolean test(GtoContext context, AEKey key) {
2525
if (context == null || key == null) return false;
2626

2727
// 逻辑推断:
@@ -40,7 +40,7 @@ protected boolean test(GtoContext context, AEKey key) {
4040
* @param amount 数量
4141
*/
4242
@Override
43-
protected void apply(GtoContext context, AEKey key, long amount) {
43+
protected <GtoContext> void apply(GtoContext context, AEKey key, long amount) {
4444
if (context == null || key == null) return;
4545

4646
// 逻辑推断:
@@ -52,15 +52,15 @@ protected void apply(GtoContext context, AEKey key, long amount) {
5252
/**
5353
* 模拟 Native 层:执行具体的合法性过滤
5454
*/
55-
private boolean isValidForConfig(GtoContext context, AEKey key) {
55+
private <GtoContext> boolean isValidForConfig(GtoContext context, AEKey key) {
5656
// 比如:只允许特定的 AE2 核心物品
5757
return true;
5858
}
5959

6060
/**
6161
* 模拟 Native 层:应用配置变更
6262
*/
63-
private void updateConfigState(GtoContext context, AEKey key, long amount) {
63+
private <GtoContext> void updateConfigState(GtoContext context, AEKey key, long amount) {
6464
// 更新后端数据模型
6565
}
6666
}

src/main/java/com/gtolib/AEKeyOutputHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* AE2 堆栈动作处理器(通常用于输出或特定功能槽位)
77
* 负责处理 AE2 增强 GUI 中针对物品/流体输出结果的验证与变更逻辑。
88
*/
9-
public class AEKeyOutputHandler extends AbstractStackHandler {
9+
public class AEKeyOutputHandler<GtoContext> extends AbstractStackHandler {
1010

1111
public AEKeyOutputHandler() {
1212
// 初始化
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.gtolib;
2+
3+
import net.minecraft.client.gui.components.events.GuiEventListener;
4+
5+
public abstract class AbstractEncodingWidget implements GuiEventListener {
6+
// Optional: provide default width/height methods
7+
public int getWidth() { return 0; }
8+
public int getHeight() { return 0; }
9+
10+
// Default empty implementations for GuiEventListener
11+
@Override
12+
public void setFocused(boolean focused) { }
13+
@Override
14+
public boolean isFocused() { return false; }
15+
}

0 commit comments

Comments
 (0)