diff options
author | thedarkcolour <30441001+thedarkcolour@users.noreply.github.com> | 2020-12-19 09:54:05 -0800 |
---|---|---|
committer | thedarkcolour <30441001+thedarkcolour@users.noreply.github.com> | 2020-12-19 09:54:05 -0800 |
commit | 668b5c35ea900750c35f2ea8d878c1c5e6a04607 (patch) | |
tree | e63f4c0e5e886256a762d409dcc73fc9d5e5321d | |
parent | 7653b26a950d3313f3f159ab76eec1f186055ac8 (diff) | |
download | KotlinForForge-668b5c35ea900750c35f2ea8d878c1c5e6a04607.tar.gz KotlinForForge-668b5c35ea900750c35f2ea8d878c1c5e6a04607.tar.bz2 KotlinForForge-668b5c35ea900750c35f2ea8d878c1c5e6a04607.zip |
Kotlin for Forge 1.7.0
18 files changed, 119 insertions, 9 deletions
@@ -25,7 +25,7 @@ To implement in an existing project, paste the following into your build.gradle: ```groovy buildscript { dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20" } } @@ -40,7 +40,7 @@ repositories { dependencies { // Use the latest version of KotlinForForge - implementation 'thedarkcolour:kotlinforforge:1.6.2' + implementation 'thedarkcolour:kotlinforforge:1.7.0' } compileKotlin { diff --git a/build.gradle b/build.gradle index 68328d6..0e288ba 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'kotlin' apply plugin: 'org.jetbrains.dokka' -version = "1.6.2" +version = "1.7.0" group = 'thedarkcolour.kotlinforforge' archivesBaseName = 'kotlinforforge' diff --git a/changelog.md b/changelog.md index e82a1f3..39310d7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,13 @@ +##Kotlin for Forge 1.7.0 +- Added `registerObject` function to KDeferredRegister for getting ObjectHolderDelegate instances + without needing a cast to ObjectHolderDelegate. +- Deprecated `register` in KDeferredRegister +- Fixed KReflect sometimes not showing up on the Maven. +- Updated to Kotlin 1.4.21, Updated to coroutines 1.4.2, Updated to JetBrains annotations 20.1.0 + +##Kotlin for Forge 1.6.2 +- Fixed errors in KotlinEventBus with certain Lambda syntax + ##Kotlin for Forge 1.6.1 - Removed inline modifier for functions `runForDist`, `runWhenOn`, and `callWhenOn` in Forge.kt. - Changed the `AutoKotlinEventBusSubscriber` to not crash when loading client only subscribers with client only members. diff --git a/gradle.properties b/gradle.properties index 65bbeb0..4dd7111 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,6 @@ kotlin.code.style=official org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -kotlin_version=1.4.10 -coroutines_version = 1.3.9 -annotations_version = 20.0.0
\ No newline at end of file +kotlin_version=1.4.21 +coroutines_version = 1.4.2 +annotations_version = 20.1.0
\ No newline at end of file diff --git a/src/main/kotlin/thedarkcolour/kotlinforforge/forge/Forge.kt b/src/main/kotlin/thedarkcolour/kotlinforforge/forge/Forge.kt index 8289456..7cc7616 100644 --- a/src/main/kotlin/thedarkcolour/kotlinforforge/forge/Forge.kt +++ b/src/main/kotlin/thedarkcolour/kotlinforforge/forge/Forge.kt @@ -247,6 +247,9 @@ private class SidedDelegate<T>(private val clientValue: () -> T, private val ser * @since 1.4.0 * [ObjectHolderDelegate] can now be used with the [KDeferredRegister]. * + * @since 1.7.0 + * [ObjectHolderDelegate] now implements () -> T. + * * @param T the type of object this delegates to * @property registryName the registry name of the object this delegate references * @property registry the registry the object of this delegate is in @@ -255,7 +258,7 @@ private class SidedDelegate<T>(private val clientValue: () -> T, private val ser public data class ObjectHolderDelegate<T : IForgeRegistryEntry<in T>>( private val registryName: ResourceLocation, private val registry: IForgeRegistry<*>, -) : ReadOnlyProperty<Any?, T>, Consumer<Predicate<ResourceLocation>>, Supplier<T> { +) : ReadOnlyProperty<Any?, T>, Consumer<Predicate<ResourceLocation>>, Supplier<T>, () -> T { /** * Should be initialized by [accept]. If you don't register * a value for [registryName] during the appropriate registry event @@ -275,6 +278,10 @@ public data class ObjectHolderDelegate<T : IForgeRegistryEntry<in T>>( return value } + override fun invoke(): T { + return value + } + /** * Refreshes the value of this ObjectHolder. * diff --git a/src/main/kotlin/thedarkcolour/kotlinforforge/forge/KDeferredRegister.kt b/src/main/kotlin/thedarkcolour/kotlinforforge/forge/KDeferredRegister.kt index e4f40e9..9e063a2 100644 --- a/src/main/kotlin/thedarkcolour/kotlinforforge/forge/KDeferredRegister.kt +++ b/src/main/kotlin/thedarkcolour/kotlinforforge/forge/KDeferredRegister.kt @@ -47,6 +47,7 @@ public class KDeferredRegister<V : IForgeRegistryEntry<V>>( } } + /** * Adds a registry object to this deferred registry. * @@ -56,7 +57,7 @@ public class KDeferredRegister<V : IForgeRegistryEntry<V>>( * * @return A new [ObjectHolderDelegate] with the given registry name and value */ - public fun <T : V> register(name: String, supplier: () -> T): ReadOnlyProperty<Any?, T> { + public fun <T : V> registerObject(name: String, supplier: () -> T): ObjectHolderDelegate<T> { val key = ResourceLocation(modid, name) val a = ObjectHolderDelegate<T>(key, registry) @@ -65,6 +66,17 @@ public class KDeferredRegister<V : IForgeRegistryEntry<V>>( return a } + /** + * Older function that only returns a property delegate. + */ + @Deprecated( + message = "Use `registerObject` for ObjectHolderDelegate return type", + replaceWith = ReplaceWith("registerObject(name, supplier)") + ) + public fun <T : V> register(name: String, supplier: () -> T): ReadOnlyProperty<Any?, T> { + return registerObject(name, supplier) + } + public fun getEntries(): Set<ObjectHolderDelegate<out V>> { return entries.keys } diff --git a/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar Binary files differnew file mode 100644 index 0000000..d921415 --- /dev/null +++ b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar diff --git a/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar.md5 b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar.md5 new file mode 100644 index 0000000..36cc69f --- /dev/null +++ b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar.md5 @@ -0,0 +1 @@ +ce0044bc8b823ae0954bcbf4474d6faa
\ No newline at end of file diff --git a/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar.sha1 b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar.sha1 new file mode 100644 index 0000000..d5960d7 --- /dev/null +++ b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar.sha1 @@ -0,0 +1 @@ +20d9f97680789a1949b6620f42f3b4063eda9b2f
\ No newline at end of file diff --git a/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar Binary files differnew file mode 100644 index 0000000..899c2e3 --- /dev/null +++ b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar diff --git a/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar.md5 b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar.md5 new file mode 100644 index 0000000..eb1c7e3 --- /dev/null +++ b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar.md5 @@ -0,0 +1 @@ +ee41e56cfde6cb4366dfd308b9c9a909
\ No newline at end of file diff --git a/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar.sha1 b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar.sha1 new file mode 100644 index 0000000..f9cfe34 --- /dev/null +++ b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar.sha1 @@ -0,0 +1 @@ +c4962f0a8a86adf71b2b51192509c4b36da4d225
\ No newline at end of file diff --git a/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom new file mode 100644 index 0000000..dd5a13f --- /dev/null +++ b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <groupId>thedarkcolour</groupId> + <artifactId>kotlinforforge</artifactId> + <version>1.7.0</version> + <dependencies> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib</artifactId> + <version>1.4.21</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk7</artifactId> + <version>1.4.21</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + <version>1.4.21</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-reflect</artifactId> + <version>1.4.21</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.jetbrains</groupId> + <artifactId>annotations</artifactId> + <version>20.1.0</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlinx</groupId> + <artifactId>kotlinx-coroutines-core</artifactId> + <version>1.4.2</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlinx</groupId> + <artifactId>kotlinx-coroutines-jdk8</artifactId> + <version>1.4.2</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> diff --git a/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom.md5 b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom.md5 new file mode 100644 index 0000000..f9f448d --- /dev/null +++ b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom.md5 @@ -0,0 +1 @@ +16fc3646bcc58cd8b2ecd2c82a79847a
\ No newline at end of file diff --git a/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom.sha1 b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom.sha1 new file mode 100644 index 0000000..1e14b73 --- /dev/null +++ b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom.sha1 @@ -0,0 +1 @@ +cb5ad553d46be42d6bb40a17cbc3668bf17007bf
\ No newline at end of file diff --git a/thedarkcolour/kotlinforforge/1.7.0/web.html b/thedarkcolour/kotlinforforge/1.7.0/web.html new file mode 100644 index 0000000..fff465f --- /dev/null +++ b/thedarkcolour/kotlinforforge/1.7.0/web.html @@ -0,0 +1,20 @@ +<html lang="HTML5"> +<link rel="stylesheet" href="../../style.css"> +<head><title>Index of /1.7.0/</title></head> +<body> +<h1>Index of /kotlinforforge/</h1> +<hr> +<pre><a href="../web.html">../</a> +<a href="kotlinforforge-1.7.0-sources.jar">kotlinforforge-1.7.0-sources.jar</a> +<a href="kotlinforforge-1.7.0-sources.jar.sha1">kotlinforforge-1.7.0-sources.jar.sha1</a> +<a href="kotlinforforge-1.7.0-sources.jar.md5">kotlinforforge-1.7.0-sources.jar.md5</a> +<a href="kotlinforforge-1.7.0.jar">kotlinforforge-1.7.0.jar</a> +<a href="kotlinforforge-1.7.0.jar.sha1">kotlinforforge-1.7.0.jar.sha1</a> +<a href="kotlinforforge-1.7.0.jar.md5">kotlinforforge-1.7.0.jar.md5</a> +<a href="kotlinforforge-1.7.0.pom">kotlinforforge-1.7.0.pom</a> +<a href="kotlinforforge-1.7.0.pom.sha1">kotlinforforge-1.7.0.pom.sha1</a> +<a href="kotlinforforge-1.7.0.pom.md5">kotlinforforge-1.7.0.pom.md5</a> +</pre> +<hr> +</body> +</html> diff --git a/thedarkcolour/kotlinforforge/maven-metadata.xml b/thedarkcolour/kotlinforforge/maven-metadata.xml index ab5e614..b2a62a9 100644 --- a/thedarkcolour/kotlinforforge/maven-metadata.xml +++ b/thedarkcolour/kotlinforforge/maven-metadata.xml @@ -3,7 +3,7 @@ <groupId>thedarkcolour</groupId> <artifactId>kotlinforforge</artifactId> <versioning> - <release>1.6.2</release> + <release>1.7.0</release> <versions> <version>1.0.0</version> <version>1.0.1</version> @@ -19,6 +19,7 @@ <version>1.6.0</version> <version>1.6.1</version> <version>1.6.2</version> + <version>1.7.0</version> </versions> </versioning> </metadata> diff --git a/thedarkcolour/kotlinforforge/web.html b/thedarkcolour/kotlinforforge/web.html index 97688b4..5bcd438 100644 --- a/thedarkcolour/kotlinforforge/web.html +++ b/thedarkcolour/kotlinforforge/web.html @@ -22,6 +22,7 @@ <a href="1.6.0/web.html">1.6.0</a> <a href="1.6.1/web.html">1.6.1</a> <a href="1.6.2/web.html">1.6.2</a> +<a href="1.7.0/web.html">1.7.0</a> <a href="maven-metadata.xml">maven-metadata.xml</a> <a href="maven-metadata.xml.md5">maven-metadata.xml.md5</a> <a href="maven-metadata.xml.sha1">maven-metadata.xml.sha1</a> |