Skip to content

Commit bf09135

Browse files
committed
fix: AccessTransformer two conf backend
refactor(forge): 重构登录超时处理并优化组件工具类 - 移除 forge-1.18.2 版本的 MixinServerLoginPacketListenerImpl 类 - 更新 forge-1.19.2 版本的 MixinServerLoginPacketListenerImpl 类,使用 UtilComponent 工具类 - 在 UtilComponent 中添加 getTranslatableComponent 和 getLiteralComponent 方法 - 更新工作流配置,使用黑smith-4vcpu-ubuntu-2404 虚拟环境 fix: gradle task dep chore: action use 16v cpu on blacksmith and fix at chore: debug action fix: at is running dur conf, so add it ci: runs on 4vcpu ci: runs on github
1 parent 3161fff commit bf09135

File tree

7 files changed

+42
-62
lines changed

7 files changed

+42
-62
lines changed

buildSrc/src/main/kotlin/club/asynclab/asyncauth/Process.kt

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import org.gradle.api.artifacts.Configuration
99
import org.gradle.api.file.SourceDirectorySet
1010
import org.gradle.api.tasks.*
1111
import org.gradle.kotlin.dsl.get
12+
import org.gradle.kotlin.dsl.named
1213
import org.gradle.kotlin.dsl.register
1314
import org.gradle.kotlin.dsl.the
1415
import org.gradle.plugins.ide.eclipse.model.EclipseModel
@@ -40,44 +41,45 @@ object Process {
4041
fun configureGenerally(minecraft: UserDevExtension): (minecraftMappingChannel: String, minecraftMappingVersion: String, mainSourceSet: SourceSet, commonSourceSet: SourceSet) -> Unit =
4142
{ minecraftMappingChannel: String, minecraftMappingVersion: String, mainSourceSet: SourceSet, commonSourceSet: SourceSet ->
4243
minecraft.apply {
43-
mappings(minecraftMappingChannel, minecraftMappingVersion)
44-
accessTransformer(project.file("src/main/resources/META-INF/accesstransformer.cfg"))
45-
accessTransformer(project.file("src/generated/brother/resources/META-INF/accesstransformer.cfg"))
46-
47-
copyIdeResources.set(true)
48-
49-
runs.apply {
50-
configureEach {
51-
workingDirectory(project.file("run"))
52-
property("forge.logging.markers", "REGISTRIES")
53-
property("forge.logging.console.level", "debug")
54-
55-
mods.apply {
56-
create(Props.MOD_ID) {
57-
source(mainSourceSet)
58-
source(commonSourceSet)
44+
project.run {
45+
mappings(minecraftMappingChannel, minecraftMappingVersion)
46+
47+
accessTransformer("src/main/resources/META-INF/accesstransformer.cfg")
48+
49+
copyIdeResources.set(true)
50+
51+
runs.apply {
52+
configureEach {
53+
workingDirectory(file("run"))
54+
property("forge.logging.markers", "REGISTRIES")
55+
property("forge.logging.console.level", "debug")
56+
57+
mods.apply {
58+
create(Props.MOD_ID) {
59+
source(mainSourceSet)
60+
source(commonSourceSet)
61+
}
5962
}
6063
}
61-
}
6264

63-
create("client") { property("forge.enabledGameTestNamespaces", Props.MOD_ID) }
64-
create("server") { property("forge.enabledGameTestNamespaces", Props.MOD_ID) }
65-
create("gameTestServer") { property("forge.enabledGameTestNamespaces", Props.MOD_ID) }
66-
create("data") {
67-
workingDirectory(project.file("run-data"))
68-
69-
args(
70-
"--mod", Props.MOD_ID,
71-
"--all",
72-
"--output", project.file("src/generated/resources/").absolutePath,
73-
"--existing", project.file("src/main/resources/").absolutePath
74-
)
65+
create("client") { property("forge.enabledGameTestNamespaces", Props.MOD_ID) }
66+
create("server") { property("forge.enabledGameTestNamespaces", Props.MOD_ID) }
67+
create("gameTestServer") { property("forge.enabledGameTestNamespaces", Props.MOD_ID) }
68+
create("data") {
69+
workingDirectory(file("run-data"))
70+
71+
args(
72+
"--mod", Props.MOD_ID,
73+
"--all",
74+
"--output", file("src/generated/resources/").absolutePath,
75+
"--existing", file("src/main/resources/").absolutePath
76+
)
77+
}
7578
}
7679
}
7780
}
7881
}
7982

80-
8183
fun createGenerateTemplates(project: Project): (props: Map<String, String>) -> SimpleDelegator<TaskProvider<Copy>> =
8284
{ props: Map<String, String> ->
8385
project.run {
@@ -142,6 +144,7 @@ object Process {
142144
tasks.named("compileJava") { dependsOn(generateFromBrother) }
143145
rootProject.the<IdeaModel>().project.settings.taskTriggers.afterSync(generateFromBrother)
144146
the<EclipseModel>().synchronizationTasks(generateFromBrother)
147+
tasks.named<Delete>("clean") { delete(generateFromBrother) }
145148
})
146149
}
147150
}

forge-1.18.2/src/main/kotlin/club/asynclab/asyncraft/asyncauth/util/UtilComponent.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import net.minecraft.network.chat.TextComponent
44
import net.minecraft.network.chat.TranslatableComponent
55

66
object UtilComponent {
7+
@JvmStatic
78
fun getTranslatableComponent(key: String) = TranslatableComponent(key)
9+
10+
@JvmStatic
811
fun getLiteralComponent(text: String) = TextComponent(text)
912
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public-f net.minecraft.server.network.ServerLoginPacketListenerImpl f_143698_

forge-1.18.2/src/main/java/club/asynclab/asyncraft/asyncauth/mixin/MixinServerLoginPacketListenerImpl.java renamed to forge-1.19.2/src/main/java/club/asynclab/asyncraft/asyncauth/mixin/MixinServerLoginPacketListenerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package club.asynclab.asyncraft.asyncauth.mixin;
22

3+
import club.asynclab.asyncraft.asyncauth.util.UtilComponent;
34
import net.minecraft.network.chat.Component;
4-
import net.minecraft.network.chat.TranslatableComponent;
55
import net.minecraft.server.network.ServerLoginPacketListenerImpl;
66
import org.objectweb.asm.Opcodes;
77
import org.spongepowered.asm.mixin.Mixin;
@@ -24,7 +24,7 @@ public abstract class MixinServerLoginPacketListenerImpl {
2424
@Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/server/network/ServerLoginPacketListenerImpl;tick:I", opcode = Opcodes.GETFIELD), cancellable = true)
2525
private void onTick(CallbackInfo ci) {
2626
if (MAX_TICKS_BEFORE_LOGIN != 0 && this.tick++ == MAX_TICKS_BEFORE_LOGIN) {
27-
this.disconnect(new TranslatableComponent("multiplayer.disconnect.slow_login"));
27+
this.disconnect(UtilComponent.getTranslatableComponent("multiplayer.disconnect.slow_login"));
2828
}
2929
ci.cancel();
3030
}

forge-1.19.2/src/main/java/java/club/asynclab/asyncraft/asyncauth/mixin/MixinServerLoginPacketListenerImpl.java

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public-f net.minecraft.server.network.ServerLoginPacketListenerImpl f_143698_

forge-1.20.1/src/main/kotlin/club/asynclab/asyncraft/asyncauth/util/UtilComponent.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import net.minecraft.network.chat.Component
44
import net.minecraft.network.chat.MutableComponent
55

66
object UtilComponent {
7+
@JvmStatic
78
fun getTranslatableComponent(key: String): MutableComponent = Component.translatable(key)
9+
@JvmStatic
810
fun getLiteralComponent(text: String): MutableComponent = Component.literal(text)
911
}

0 commit comments

Comments
 (0)