Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into feature/disable_window_input_on…
Browse files Browse the repository at this point in the history
…_failure
  • Loading branch information
CallumBugajski committed Sep 18, 2024
2 parents c35ceec + ddd0c43 commit 531a699
Show file tree
Hide file tree
Showing 110 changed files with 6,971 additions and 328 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- unstable/import
pull_request:

jobs:
Expand All @@ -12,9 +13,9 @@ jobs:
env:
ORG_GRADLE_PROJECT_branch: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: |
Expand All @@ -23,11 +24,11 @@ jobs:
17
# Can't use setup-java for this because https://github.com/actions/setup-java/issues/366
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,3 @@ options.txt
usercache.json
usernamecache.json
*.txt

versions/*/tmp.srg
versions/*/api/
139 changes: 40 additions & 99 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,110 +11,46 @@ instead you simply have to describe _what_ you want.

## Dependency

It's recommended that you include [Essential](link eventually) instead of adding it yourself.

In your repository block, add:

Groovy
```groovy
maven {
url = "https://repo.essential.gg/repository/maven-public"
}
```
Kotlin
```kotlin
maven(url = "https://repo.essential.gg/repository/maven-public")
```

To use the latest builds, use the following dependency:

<details><summary>Forge</summary>

```kotlin
implementation("gg.essential:elementa-$mcVersion-$mcPlatform:$buildNumber")
```
</details>
<details><summary>Fabric</summary>

Groovy
```groovy
modImplementation(include("gg.essential:elementa-$mcVersion-$mcPlatform:$buildNumber"))
```
Kotlin
```kotlin
modImplementation(include("gg.essential:elementa-$mcVersion-$mcPlatform:$buildNumber")!!)
repository {
// All versions of Elementa and UniversalCraft are published to Essential's public maven repository.
// (if you're still using Groovy build scripts, replace `()` with `{}`)
maven(url = "https://repo.essential.gg/repository/maven-public")
}
dependencies {
// Add Elementa dependency. For the latest $elementaVersion, see the badge below this code snippet.
implementation("gg.essential:elementa:$elementaVersion")

// Optionally, add some of the unstable Elementa features.
// Note that these MUST be relocated to your own package because future versions may contain breaking changes
// and therefore MUST NOT be simply included via Fabric's jar-in-jar mechanism.
implementation("gg.essential:elementa-unstable-layoutdsl:$elementaVersion")

// Elementa itself is independent of Minecraft versions and mod loaders, instead it depends on UniversalCraft which
// provides bindings to specific Minecraft versions.
// As such, you must include the UniversalCraft version for the Minecraft version + mod loader you're targeting.
// For a list of all available platforms, see https://github.com/EssentialGG/UniversalCraft
// For your convenience, the latest $ucVersion is also included in a badge below this code snippet.
// (Note: if you are not using Loom, replace `modImplementation` with `implementation` or your equivalent)
modImplementation("gg.essential:universalcraft-1.8.9-forge:$ucVersion")

// If you're using Fabric, you may use its jar-in-jar mechanism to bundle Elementa and UniversalCraft with your
// mod by additionally adding them to the `include` configuration like this (in place of the above):
implementation(include("gg.essential:elementa:$elementaVersion")!!)
modImplementation(include("gg.essential:universalcraft-1.8.9-forge:$ucVersion"))
// If you're using Forge, you must instead include them directly into your jar file and relocate them to your
// own package (this is important! otherwise you will be incompatible with other mods!)
// using e.g. https://gradleup.com/shadow/configuration/relocation/
// For an example, read the IMPORTANT section below.
}
```
</details>

### Build Reference
<details><summary>Build Reference</summary>
<table>
<tbody>
<tr>
<th>mcVersion</th>
<th>mcPlatform</th>
<th>buildNumber</th>
</tr>
<tr>
<td>1.18.1</td>
<td>fabric</td>
<td>
<img alt="1.18.1-fabric" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/elementa-1.18.1-fabric/maven-metadata.xml">
</td>
</tr>
<tr>
<td>1.18.1</td>
<td>forge</td>
<td>
<img alt="1.18.1-forge" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/elementa-1.18.1-forge/maven-metadata.xml">
</td>
</tr>
<tr>
<td>1.17.1</td>
<td>fabric</td>
<td>
<img alt="1.17.1-fabric" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/elementa-1.17.1-fabric/maven-metadata.xml">
</td>
</tr>
<tr>
<td>1.17.1</td>
<td>forge</td>
<td>
<img alt="1.17.1-forge" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/elementa-1.17.1-forge/maven-metadata.xml">
</td>
</tr>
<tr>
<td>1.16.2</td>
<td>forge</td>
<td>
<img alt="1.16.2-forge" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/elementa-1.16.2-forge/maven-metadata.xml">
</td>
</tr>
<tr>
<td>1.12.2</td>
<td>forge</td>
<td>
<img alt="1.12.2-forge" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/elementa-1.12.2-forge/maven-metadata.xml">
</td>
</tr>
<tr>
<td>1.8.9</td>
<td>forge</td>
<td><img alt="1.8.9-forge" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=%20&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/elementa-1.8.9-forge/maven-metadata.xml"></td>
</tr>
</tbody>
</table>

</details>

If you were previously using v1.7.1 of Elementa and are now on the v2.0.0 builds, please refer to the
[migration](docs/migration.md) document to know what has changed.

To learn about all the new features in v2.0.0, please read the [what's new](docs/whatsnew.md) document.
<img alt="gg.essential:elementa" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=Latest%20Elementa&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/elementa/maven-metadata.xml">
<img alt="gg.essential:universalcraft-1.8.9-forge" src="https://img.shields.io/badge/dynamic/xml?color=A97BFF&label=Latest%20UniversalCraft&query=/metadata/versioning/versions/version[not(contains(text(),'%2B'))][last()]&url=https://repo.essential.gg/repository/maven-releases/gg/essential/universalcraft-1.8.9-forge/maven-metadata.xml">

<h2><span style="font-size:3em; color:red;">IMPORTANT!</span></h2>

If you are using forge, you must also relocate Elementa to avoid potential crashes with other mods. To do this, you will need to use the Shadow Gradle plugin.
If you are using Forge, you must also relocate Elementa to avoid incompatibility with other mods.
To do this, you may use the Shadow Gradle plugin:

<details><summary>Groovy Version</summary>

Expand Down Expand Up @@ -191,6 +127,11 @@ In your dependencies block, add:
implementation "club.sk1er:Elementa:1.7.1-$mcVersion"
```

If you were previously using v1.7.1 of Elementa and are now on the v2.0.0 builds, please refer to the
[migration](docs/migration.md) document to know what has changed.

To learn about all the new features in v2.0.0, please read the [what's new](docs/whatsnew.md) document.

## Components

All the drawing in Elementa is done via UIComponents. There is a root component named `Window`
Expand Down
14 changes: 14 additions & 0 deletions api/Elementa.api
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public final class gg/essential/elementa/ElementaVersion : java/lang/Enum {
public static final field V3 Lgg/essential/elementa/ElementaVersion;
public static final field V4 Lgg/essential/elementa/ElementaVersion;
public static final field V5 Lgg/essential/elementa/ElementaVersion;
public static final field V6 Lgg/essential/elementa/ElementaVersion;
public final fun enableFor (Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public static fun valueOf (Ljava/lang/String;)Lgg/essential/elementa/ElementaVersion;
public static fun values ()[Lgg/essential/elementa/ElementaVersion;
Expand Down Expand Up @@ -169,6 +170,11 @@ public final class gg/essential/elementa/UIComponent$Companion {
public final fun guiHint (FZ)F
}

public final class gg/essential/elementa/UIComponent$sam$i$java_util_function_Predicate$0 : java/util/function/Predicate {
public fun <init> (Lkotlin/jvm/functions/Function1;)V
public final synthetic fun test (Ljava/lang/Object;)Z
}

public class gg/essential/elementa/UIConstraints : java/util/Observable {
public fun <init> (Lgg/essential/elementa/UIComponent;)V
public final fun copy ()Lgg/essential/elementa/UIConstraints;
Expand Down Expand Up @@ -2560,8 +2566,16 @@ public final class gg/essential/elementa/dsl/UtilitiesKt {
public static final fun toConstraint (Ljava/awt/Color;)Lgg/essential/elementa/constraints/ConstantColorConstraint;
public static final fun width (CF)F
public static final fun width (Ljava/lang/String;FLgg/essential/elementa/font/FontProvider;)F
public static final synthetic fun width (Lnet/minecraft/class_2561;FLgg/essential/elementa/font/FontProvider;)F
public static final synthetic fun width (Lnet/minecraft/network/chat/Component;FLgg/essential/elementa/font/FontProvider;)F
public static final synthetic fun width (Lnet/minecraft/util/IChatComponent;FLgg/essential/elementa/font/FontProvider;)F
public static final synthetic fun width (Lnet/minecraft/util/text/ITextComponent;FLgg/essential/elementa/font/FontProvider;)F
public static synthetic fun width$default (CFILjava/lang/Object;)F
public static synthetic fun width$default (Ljava/lang/String;FLgg/essential/elementa/font/FontProvider;ILjava/lang/Object;)F
public static synthetic fun width$default (Lnet/minecraft/class_2561;FLgg/essential/elementa/font/FontProvider;ILjava/lang/Object;)F
public static synthetic fun width$default (Lnet/minecraft/network/chat/Component;FLgg/essential/elementa/font/FontProvider;ILjava/lang/Object;)F
public static synthetic fun width$default (Lnet/minecraft/util/IChatComponent;FLgg/essential/elementa/font/FontProvider;ILjava/lang/Object;)F
public static synthetic fun width$default (Lnet/minecraft/util/text/ITextComponent;FLgg/essential/elementa/font/FontProvider;ILjava/lang/Object;)F
}

public abstract class gg/essential/elementa/effects/Effect {
Expand Down
40 changes: 35 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
import gg.essential.gradle.multiversion.StripReferencesTransform.Companion.registerStripReferencesAttribute
import gg.essential.gradle.util.*
import gg.essential.gradle.util.RelocationTransform.Companion.registerRelocationAttribute
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.6.10"
kotlin("jvm") version "1.9.23"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.8.0"
id("org.jetbrains.dokka") version "1.6.10" apply false
id("org.jetbrains.dokka") version "1.9.20"
id("gg.essential.defaults")
id("gg.essential.defaults.maven-publish")
}

group = "gg.essential"
version = versionFromBuildIdAndBranch()

kotlin.jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8))
}
tasks.compileKotlin.setJvmDefault("all-compatibility")

tasks.withType<KotlinCompile> {
setJvmDefault("all-compatibility")
kotlinOptions {
languageVersion = "1.6"
apiVersion = "1.6"
}
}

val internal by configurations.creating {
val relocated = registerRelocationAttribute("internal-relocated") {
Expand All @@ -39,6 +51,7 @@ dependencies {
internal(libs.dom4j)
implementation(prebundle(internal))

compileOnly(project(":mc-stubs"))
// Depending on LWJGL3 instead of 2 so we can choose opengl bindings only
compileOnly("org.lwjgl:lwjgl-opengl:3.3.1")
// Depending on 1.8.9 for all of these because that's the oldest version we support
Expand All @@ -48,8 +61,25 @@ dependencies {
compileOnly("com.google.code.gson:gson:2.2.4")
}

tasks.processResources {
inputs.property("project.version", project.version)
filesMatching("fabric.mod.json") {
expand("version" to project.version)
}
}

tasks.jar {
dependsOn(internal)
from({ internal.map { zipTree(it) } })
}

apiValidation {
ignoredProjects.add("platform")
ignoredPackages.add("com.example")
ignoredProjects.addAll(subprojects.map { it.name })
nonPublicMarkers.add("org.jetbrains.annotations.ApiStatus\$Internal")
}

java.withSourcesJar()

publishing.publications.named<MavenPublication>("maven") {
artifactId = "elementa"
}
File renamed without changes.
File renamed without changes.
47 changes: 1 addition & 46 deletions versions/build.gradle.kts → example/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
import gg.essential.gradle.multiversion.excludeKotlinDefaultImpls
import gg.essential.gradle.multiversion.mergePlatformSpecifics
import gg.essential.gradle.util.*

plugins {
kotlin("jvm")
id("org.jetbrains.dokka")
id("gg.essential.multi-version")
id("gg.essential.defaults")
id("gg.essential.defaults.maven-publish")
}

group = "gg.essential"

java.withSourcesJar()
tasks.compileKotlin.setJvmDefault(if (platform.mcVersion >= 11400) "all" else "all-compatibility")
loom.noServerRunConfigs()

val common by configurations.creating
configurations.compileClasspath { extendsFrom(common) }
configurations.runtimeClasspath { extendsFrom(common) }

dependencies {
implementation(libs.kotlin.stdlib.jdk8)
implementation(libs.kotlin.reflect)
Expand All @@ -29,7 +18,7 @@ dependencies {
exclude(group = "org.jetbrains.kotlin")
}

common(project(":"))
implementation(project(":example:common"))

if (platform.isFabric) {
val fabricApiVersion = when(platform.mcVersion) {
Expand Down Expand Up @@ -57,37 +46,3 @@ dependencies {
}
}
}

tasks.processResources {
filesMatching(listOf("fabric.mod.json")) {
filter { it.replace("\"com.example.examplemod.ExampleMod\"", "") }
}
}

tasks.dokkaHtml {
moduleName.set("Elementa $name")
}

tasks.jar {
dependsOn(common)
from({ common.map { zipTree(it) } })
mergePlatformSpecifics()

// We build the common module with legacy default impl for backwards compatibility, but we only need those for
// 1.12.2 and older. Newer versions have never shipped with legacy default impl.
if (platform.mcVersion >= 11400) {
excludeKotlinDefaultImpls()
}

exclude("com/example/examplemod/**")
exclude("META-INF/mods.toml")
exclude("mcmod.info")
exclude("kotlin/**")
manifest {
attributes(mapOf("FMLModType" to "LIBRARY"))
}
}

tasks.named<Jar>("sourcesJar") {
from(project(":").sourceSets.main.map { it.allSource })
}
Loading

0 comments on commit 531a699

Please sign in to comment.