-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
用于适配多个minecraft版本
- Loading branch information
Showing
20 changed files
with
208 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
packages/ | ||
extract/ | ||
run/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import io.itsusinn.pkg.pkgIn | ||
|
||
plugins { | ||
java | ||
id("fabric-loom") | ||
id("org.jetbrains.kotlin.jvm") | ||
id("org.jetbrains.kotlin.plugin.serialization") | ||
id("com.github.johnrengelman.shadow") | ||
id("io.itsusinn.pkg") | ||
} | ||
pkg { | ||
excludePath("mappings/*") | ||
excludePath("META-INF/*.kotlin_module") | ||
excludePath("*.md") | ||
excludePath("DebugProbesKt.bin") | ||
shadowJar { | ||
tasks.remapJar { | ||
val task = this@shadowJar | ||
dependsOn(task) | ||
mustRunAfter(task) | ||
input.set(task.outputs.files.singleFile) | ||
// 这里需要借助fabric-loom进行remap | ||
} | ||
minimize() | ||
} | ||
relocateKotlinxLib() | ||
relocateKotlinStdlib() | ||
} | ||
tasks { | ||
processResources { | ||
inputs.property("version", project.version) | ||
filesMatching("fabric.mod.json") { | ||
expand(mutableMapOf("version" to project.version)) | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
modImplementation("net.fabricmc:fabric-loader:0.12.2") | ||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.29.3+1.16") | ||
|
||
minecraft("com.mojang:minecraft:1.16.5") | ||
mappings("net.fabricmc:yarn:1.16.5+build.1:v2") | ||
|
||
pkgIn( | ||
project(":common").apply { | ||
isTransitive = false | ||
} | ||
) | ||
pkgIn("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-native-mt") | ||
pkgIn("io.nats:jnats:${property("nats_version")}") | ||
pkgIn("org.meowcat:mesagisto-client-jvm:${property("mesagisto_client_version")}") | ||
pkgIn("com.charleskorn.kaml:kaml:0.38.0") | ||
} |
17 changes: 17 additions & 0 deletions
17
1_16_5/src/main/java/org/meowcat/mesagisto/farbic/impl/ChatImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.meowcat.mesagisto.farbic.impl | ||
|
||
import net.minecraft.network.MessageType | ||
import net.minecraft.server.MinecraftServer | ||
import net.minecraft.text.Text | ||
import org.meowcat.mesagisto.farbic.api.IChat | ||
import java.util.* // ktlint-disable no-wildcard-imports | ||
|
||
class ChatImpl : IChat { | ||
override fun setServer(server: MinecraftServer) { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun broadcastMessage(message: Text, type: MessageType, senderUuid: UUID) { | ||
TODO("Not yet implemented") | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
1_16_5/src/main/java/org/meowcat/mesagisto/farbic/mixin/ServerChatMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.meowcat.mesagisto.farbic.mixin; | ||
|
||
import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket; | ||
import net.minecraft.server.network.ServerPlayNetworkHandler; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.meowcat.mesagisto.farbic.Mod; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(ServerPlayNetworkHandler.class) | ||
public class ServerChatMixin { | ||
@Shadow | ||
public ServerPlayerEntity player; | ||
|
||
@Inject(at = @At("TAIL"), method = "onGameMessage(Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;)V") | ||
public void onChat(ChatMessageC2SPacket packet, CallbackInfo ci) { | ||
ServerPlayerEntity player = this.player; | ||
String message = packet.getChatMessage(); | ||
Mod.INSTANCE.onServerChat(player, message); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
1_16_5/src/main/resources/META-INF/services/org.meowcat.mesagisto.farbic.api.IChat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.meowcat.mesagisto.farbic.impl.ChatImpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,6 @@ | |
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
}, | ||
"refmap": "1_16_5-refmap.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,33 @@ | ||
plugins { | ||
id("fabric-loom") version "0.8-SNAPSHOT" | ||
java | ||
id("fabric-loom") version "0.10-SNAPSHOT" | ||
id("org.jetbrains.kotlin.jvm") version ("1.6.0") | ||
id("org.jetbrains.kotlin.plugin.serialization")version ("1.6.0") | ||
id("com.github.johnrengelman.shadow")version ("7.1.0") | ||
id("org.meowcat.kato") version "0.1.0-dev31" | ||
id("io.itsusinn.pkg") version "1.2.0" | ||
} | ||
|
||
group = property("maven_group")!! | ||
version = property("mod_version")!! | ||
|
||
repositories { | ||
mavenCentral() | ||
maven("https://jitpack.io") | ||
mavenLocal() | ||
} | ||
kato { | ||
excludePath("kotlin/*") | ||
excludePath("kotlinx/coroutines/*") | ||
excludePath("kotlinx/serialization/*") | ||
excludePath("mappings/*") | ||
excludePath("META-INF/*.kotlin_module") | ||
excludePath("*.md") | ||
excludePath("DebugProbesKt.bin") | ||
excludeGroups( | ||
"org.lwjgl", | ||
"net.fabricmc", | ||
"org.ow2.asm", | ||
"net.minecraft", | ||
"com.mojang", | ||
"net.java.dev.jna", | ||
"com.google.jimfs", | ||
"org.jetbrains.kotlinx", | ||
"org.jetbrains.kotlin", | ||
"org.apache.logging.log4j", | ||
"net.java.jinput", | ||
"net.java.jutils", | ||
"org.apache.commons", | ||
"org.apache.httpcomponents", | ||
"commons-logging", | ||
"com.ibm.icu", | ||
"it.unimi.dsi", | ||
"ca.weblite", | ||
"net.minecrell", | ||
"com.google.guava", | ||
"commons-io", | ||
"commons-codec", | ||
"com.google.code.gson", | ||
"oshi-project", | ||
"io.netty", | ||
"net.sf.jopt-simple", | ||
"net_fabricmc_yarn_1_16_5_1_16_5_build_1_v2.net.fabricmc.fabric-api", | ||
"net_fabricmc_yarn_1_16_5_1_16_5_build_1_v2.net.fabricmc", | ||
) | ||
shadowJar { | ||
minimize() | ||
} | ||
} | ||
java { | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(16)) | ||
allprojects { | ||
group = property("maven_group")!! | ||
version = property("mod_version")!! | ||
repositories { | ||
mavenCentral() | ||
maven("https://jitpack.io") | ||
mavenLocal() | ||
maven("https://maven.fabricmc.net/") | ||
} | ||
// java { | ||
// sourceCompatibility = JavaVersion.VERSION_1_8 | ||
// targetCompatibility = JavaVersion.VERSION_1_8 | ||
// } | ||
// tasks.compileKotlin { | ||
// kotlinOptions { | ||
// jvmTarget = "1.8" | ||
// freeCompilerArgs = listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn") | ||
// } | ||
// sourceCompatibility = "1.8" | ||
// } | ||
} | ||
dependencies { | ||
minecraft("com.mojang:minecraft:${property("minecraft_version")}") | ||
mappings("net.fabricmc:yarn:${property("yarn_mappings")}:v2") | ||
|
||
modCompileClasspath("net.fabricmc:fabric-loader:${property("loader_version")}") | ||
|
||
modImplementation("net.fabricmc:fabric-language-kotlin:${property("fabric_kotlin_version")}") | ||
modImplementation("net.fabricmc.fabric-api:fabric-api:${property("fabric_api_version")}") | ||
|
||
compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.0") | ||
implementation("io.nats:jnats:2.13.1") | ||
implementation("org.meowcat:mesagisto-client-jvm:1.1.0") | ||
// implementation("org.meowcat:mesagisto-client:1.0.14-build") | ||
implementation("io.arrow-kt:arrow-core:1.0.0") | ||
implementation("com.charleskorn.kaml:kaml:0.37.0") | ||
} | ||
tasks { | ||
processResources { | ||
inputs.property("version", project.version) | ||
filesMatching("fabric.mod.json") { | ||
expand(mutableMapOf("version" to project.version)) | ||
} | ||
} | ||
compileKotlin { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
freeCompilerArgs = listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn") | ||
} | ||
sourceCompatibility = "1.8" | ||
} | ||
minecraft("com.mojang:minecraft:1.16.5") | ||
mappings("net.fabricmc:yarn:1.16.5+build.1:v2") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
plugins { | ||
java | ||
id("fabric-loom") | ||
id("org.jetbrains.kotlin.jvm") | ||
id("org.jetbrains.kotlin.plugin.serialization") | ||
} | ||
tasks.compileKotlin { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
freeCompilerArgs = listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn") | ||
} | ||
sourceCompatibility = "1.8" | ||
} | ||
|
||
dependencies { | ||
modCompileOnly("net.fabricmc:fabric-loader:${property("loader_version")}") | ||
modCompileOnly("net.fabricmc.fabric-api:fabric-api:${property("fabric_api_version")}") | ||
|
||
minecraft("com.mojang:minecraft:1.16.5") | ||
mappings("net.fabricmc:yarn:1.16.5+build.1:v2") | ||
|
||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-native-mt") | ||
implementation("io.nats:jnats:${property("nats_version")}") | ||
implementation("org.meowcat:mesagisto-client-jvm:${property("mesagisto_client_version")}") | ||
// implementation("org.meowcat:mesagisto-client:1.0.14-build") | ||
implementation("com.charleskorn.kaml:kaml:0.38.0") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
common/src/main/java/org/meowcat/mesagisto/farbic/ModAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.meowcat.mesagisto.farbic; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
|
||
public class ModAdapter implements ModInitializer { | ||
@Override | ||
public void onInitialize() { | ||
Mod.INSTANCE.onInitialize(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
common/src/main/java/org/meowcat/mesagisto/farbic/api/IChat.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.meowcat.mesagisto.farbic.api | ||
|
||
import net.minecraft.network.MessageType | ||
import net.minecraft.server.MinecraftServer | ||
import net.minecraft.text.Text | ||
import java.util.* // ktlint-disable no-wildcard-imports | ||
|
||
interface IChat { | ||
fun setServer(server: MinecraftServer) | ||
fun broadcastMessage( | ||
message: Text, | ||
type: MessageType = MessageType.CHAT, | ||
senderUuid: UUID = UUID.randomUUID() | ||
) | ||
} |
Oops, something went wrong.