Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Merge branch 'translation-rewrite'
Browse files Browse the repository at this point in the history
  • Loading branch information
Earthcomputer committed Jun 7, 2022
2 parents 58ae075 + 81f6e54 commit 00e5228
Show file tree
Hide file tree
Showing 1,543 changed files with 442,882 additions and 19,015 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ run/*
changelog.txt

*.class

src/generated/
18 changes: 0 additions & 18 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 9 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ bridges.
1. Download multiconnect from the [releases page](https://github.com/Earthcomputer/multiconnect/releases)
and move it to the mods folder (`.minecraft/mods`).

## Build Instructions
1. Building requires JDK17.
2.
1. On Windows, run `gradlew build`
2. On Linux and MacOS, run `./gradlew build`
3. Note: sometimes, especially on development versions, the tests may fail. To skip the tests, use `./gradlew build -x test`
3. The JAR file can be found in `build/libs` (it's the one with the shortest name).

## Installation for Mod Developers
This section is for when you are developing your own mod and want to use the multiconnect API, or run multiconnect alongside your mod in the IDE. Aside from the first step, you ONLY need to follow the steps applicable to you and your mod.
1. Explicitly setting a repository is not necessary, as multiconnect is hosted on Maven Central.
Expand All @@ -65,26 +73,4 @@ This section is for when you are developing your own mod and want to use the mul
- Note: this step is only necessary if you want to run the full mod in the IDE. Otherwise you can skip this step.

## Contributing
1. Clone the repository
```
git clone https://github.com/Earthcomputer/multiconnect
cd multiconnect
```
1. Generate the Minecraft source code
```
./gradlew genSources
```
- Note: on Windows, use `gradlew` rather than `./gradlew`.
1. Import the project into your preferred IDE.
1. If you use IntelliJ (the preferred option), you can simply import the project as a Gradle project.
1. If you use Eclipse, you need to `./gradlew eclipse` before importing the project as an Eclipse project.
1. Edit the code.
1. After testing in the IDE, build a JAR to test whether it works outside the IDE too
```
./gradlew build
```
The mod JAR may be found in the `build/libs` directory
1. [Create a pull request](https://help.github.com/en/articles/creating-a-pull-request)
so that your changes can be integrated into multiconnect
- Note: for large contributions, create an issue before doing all that
work, to ask whether your pull request is likely to be accepted
See [contributing.md](docs/contributing.md)
19 changes: 19 additions & 0 deletions annotationProcessor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

plugins {
kotlin("jvm") version "1.6.10"
kotlin("plugin.serialization") version "1.6.10"
}

repositories {
mavenCentral()
}

dependencies {
implementation(project(":annotations"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10")
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>() {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.earthcomputer.multiconnect.ap

import javax.lang.model.element.Element

interface ErrorConsumer {
fun report(message: String, element: Element)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.earthcomputer.multiconnect.ap

import kotlinx.serialization.encodeToString
import javax.annotation.processing.ProcessingEnvironment
import javax.lang.model.element.Element
import javax.lang.model.element.ElementKind
import javax.lang.model.element.TypeElement
import javax.tools.StandardLocation

object MessageProcessor {
fun process(type: Element, errorConsumer: ErrorConsumer, processingEnv: ProcessingEnvironment) {
if (type !is TypeElement) return
if (type.kind != ElementKind.INTERFACE) {
errorConsumer.report("@Message type must be an interface", type)
return
}

val packageName = processingEnv.elementUtils.getPackageOf(type).qualifiedName.toString()
val jsonFile = processingEnv.filer.createResource(
StandardLocation.CLASS_OUTPUT,
packageName,
type.qualifiedName.toString().substring(packageName.length + 1) + ".json"
)
val messageType = MessageType()
jsonFile.openWriter().use { writer ->
writer.write(JSON.encodeToString(messageType))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.earthcomputer.multiconnect.ap

import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable

@Serializable
class MessageType @OptIn(ExperimentalSerializationApi::class) constructor(
@EncodeDefault(EncodeDefault.Mode.ALWAYS) val type: String = "message"
)
Loading

0 comments on commit 00e5228

Please sign in to comment.