Update Traditional Chinese #64

Open
notlin4 wants to merge 4 commits from notlin4/e4mc_minecraft:notlin4-patch-1 into main
9 changed files with 67 additions and 8 deletions
Showing only changes of commit 20b7139acf - Show all commits

23
README.md Normal file
View file

@ -0,0 +1,23 @@
# [e4mc_minecraft](https://e4mc.link)
[![Modrinth Downloads](https://img.shields.io/modrinth/dt/qANg5Jrr?color=%2300af5c&logo=modrinth&style=for-the-badge)](https://modrinth.com/project/qANg5Jrr)
[![Modrinth Followers](https://img.shields.io/modrinth/followers/qANg5Jrr?color=00af5c&logo=modrinth&style=for-the-badge)](https://modrinth.com/project/qANg5Jrr)
[![CurseForge Sucks](https://img.shields.io/badge/cuseforge-sucks-f16436?style=for-the-badge)](https://curseforge.com/minecraft/mc-mods/e4mc)
Open a LAN server to anyone, anywhere, anytime.
## Install
[Modrinth](https://modrinth.com/project/qANg5Jrr)
## Usage
Open to LAN as normal
## Contributing
Please contribute
## License
[MIT](LICENSE)

View file

@ -3,5 +3,5 @@ org.gradle.jvmargs=-Xmx2G
mod.name=e4mc mod.name=e4mc
mod.id=e4mc_minecraft mod.id=e4mc_minecraft
mod.version=3.0.0 mod.version=3.1.0
mod.group=vg.skye mod.group=vg.skye

0
gradlew vendored Normal file → Executable file
View file

View file

@ -11,6 +11,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import vg.skye.e4mc_minecraft.E4mcClient; import vg.skye.e4mc_minecraft.E4mcClient;
@ -45,9 +46,9 @@ public abstract class ServerNetworkIoMixin {
} }
} }
@Redirect(method = "bind", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/ServerBootstrap;channel(Ljava/lang/Class;)Lio/netty/bootstrap/AbstractBootstrap;", remap = false)) @ModifyArg(method = "bind", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/ServerBootstrap;channel(Ljava/lang/Class;)Lio/netty/bootstrap/AbstractBootstrap;", remap = false))
private AbstractBootstrap<ServerBootstrap, ServerChannel> redirectChannel(ServerBootstrap instance, Class<? extends ServerSocketChannel> aClass) { private Class<? extends ServerChannel> redirectChannel(Class<? extends ServerChannel> aClass) {
return initializingE4mc.get() ? instance.channel(LocalServerChannel.class) : instance.channel(aClass); return initializingE4mc.get() ? LocalServerChannel.class : aClass;
} }
@Redirect(method = "bind", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/ServerBootstrap;localAddress(Ljava/net/InetAddress;I)Lio/netty/bootstrap/AbstractBootstrap;", remap = false)) @Redirect(method = "bind", at = @At(value = "INVOKE", target = "Lio/netty/bootstrap/ServerBootstrap;localAddress(Ljava/net/InetAddress;I)Lio/netty/bootstrap/AbstractBootstrap;", remap = false))

View file

@ -33,7 +33,7 @@ object E4mcClient : ModInitializer {
//#endif //#endif
const val NAME = "e4mc" const val NAME = "e4mc"
const val ID = "e4mc_minecraft" const val ID = "e4mc_minecraft"
const val VERSION = "3.0.0" const val VERSION = "3.1.0"
@JvmField @JvmField
val LOGGER: Logger = LoggerFactory.getLogger("e4mc") val LOGGER: Logger = LoggerFactory.getLogger("e4mc")
@JvmField @JvmField
@ -49,6 +49,13 @@ object E4mcClient : ModInitializer {
dispatcher.register(literal("e4mc") dispatcher.register(literal("e4mc")
.then( .then(
literal("stop") literal("stop")
.requires { src ->
if (src.server.isDedicated) {
src.hasPermissionLevel(4)
} else {
src.server.isHost((src.player ?: return@requires false).gameProfile)
}
}
.executes { context -> .executes { context ->
if (HANDLER != null) { if (HANDLER != null) {
HANDLER!!.close() HANDLER!!.close()

View file

@ -42,7 +42,7 @@ data class DomainAssignedMessage(val DomainAssigned: String)
data class ChannelOpenMessage(val ChannelOpen: List<Any>) data class ChannelOpenMessage(val ChannelOpen: List<Any>)
data class ChannelClosedMessage(val ChannelClosed: Number) data class ChannelClosedMessage(val ChannelClosed: Number)
class E4mcRelayHandler: WebSocketClient(URI("wss://ingress.e4mc.link")) { class E4mcRelayHandler: WebSocketClient(URI(System.getProperty("vg.skye.e4mc_minecraft.ingress_uri", "wss://ingress.e4mc.link"))) {
private val gson = Gson() private val gson = Gson()
private val childChannels = mutableMapOf<Int, LocalChannel>() private val childChannels = mutableMapOf<Int, LocalChannel>()
private val messageQueue = mutableMapOf<Int, ArrayBlockingQueue<ByteBuffer>>() private val messageQueue = mutableMapOf<Int, ArrayBlockingQueue<ByteBuffer>>()
@ -86,6 +86,26 @@ class E4mcRelayHandler: WebSocketClient(URI("wss://ingress.e4mc.link")) {
override fun onError(ex: java.lang.Exception) { override fun onError(ex: java.lang.Exception) {
ex.printStackTrace() ex.printStackTrace()
//#if FABRIC==1
val isClient = FabricLoader.getInstance().environmentType.equals(EnvType.CLIENT)
//#else
//$$ val isClient = FMLLoader.getDist().isClient
//#endif
if (isClient) {
try {
MinecraftClient.getInstance().inGameHud.chatHud.addMessage(
//#if MC>=11900
Text.translatable("text.e4mc_minecraft.error")
//#elseif FABRIC==1
//$$ TranslatableText("text.e4mc_minecraft.error")
//#else
//$$ TranslatableComponent("text.e4mc_minecraft.error")
//#endif
)
} catch (e: Exception) {
e.printStackTrace()
}
}
} }
private fun handleDomainAssigned(json: JsonObject) { private fun handleDomainAssigned(json: JsonObject) {

View file

@ -2,5 +2,6 @@
"text.e4mc_minecraft.domainAssigned": "Local game hosted on domain [%s]", "text.e4mc_minecraft.domainAssigned": "Local game hosted on domain [%s]",
"text.e4mc_minecraft.closeServer": "Local game no longer publicly hosted", "text.e4mc_minecraft.closeServer": "Local game no longer publicly hosted",
"text.e4mc_minecraft.serverAlreadyClosed": "Local game not publicly hosted", "text.e4mc_minecraft.serverAlreadyClosed": "Local game not publicly hosted",
"text.e4mc_minecraft.clickToStop": " (Click here to stop)" "text.e4mc_minecraft.clickToStop": " (Click here to stop)",
"text.e4mc_minecraft.error": "An error occurred in e4mc"
} }

View file

@ -2,5 +2,6 @@
"text.e4mc_minecraft.domainAssigned": "로컬 게임을 도메인 [%s]에서 호스트합니다", "text.e4mc_minecraft.domainAssigned": "로컬 게임을 도메인 [%s]에서 호스트합니다",
"text.e4mc_minecraft.closeServer": "로컬 게임이 더이상 공개되지 않습니다", "text.e4mc_minecraft.closeServer": "로컬 게임이 더이상 공개되지 않습니다",
"text.e4mc_minecraft.serverAlreadyClosed": "로컬 게임이 이미 공개중이 아닙니다", "text.e4mc_minecraft.serverAlreadyClosed": "로컬 게임이 이미 공개중이 아닙니다",
"text.e4mc_minecraft.clickToStop": " (멉추려면 여기를 클릭하세요)" "text.e4mc_minecraft.clickToStop": " (멉추려면 여기를 클릭하세요)",
"text.e4mc_minecraft.error": "e4mc에서 오류가 발생했습니다."
} }

View file

@ -0,0 +1,6 @@
{
"text.e4mc_minecraft.domainAssigned": "将本地游戏托管在域名[%s]上",
"text.e4mc_minecraft.closeServer": "不再公开托管本地游戏",
"text.e4mc_minecraft.serverAlreadyClosed": "本地游戏没有被公开托管",
"text.e4mc_minecraft.clickToStop": "(点击这里以停止)"
}