From 668b5c35ea900750c35f2ea8d878c1c5e6a04607 Mon Sep 17 00:00:00 2001 From: thedarkcolour <30441001+thedarkcolour@users.noreply.github.com> Date: Sat, 19 Dec 2020 09:54:05 -0800 Subject: Kotlin for Forge 1.7.0 --- README.md | 4 +- build.gradle | 2 +- changelog.md | 10 ++++ gradle.properties | 6 +-- .../thedarkcolour/kotlinforforge/forge/Forge.kt | 9 +++- .../kotlinforforge/forge/KDeferredRegister.kt | 14 +++++- .../1.7.0/kotlinforforge-1.7.0-sources.jar | Bin 0 -> 38842 bytes .../1.7.0/kotlinforforge-1.7.0-sources.jar.md5 | 1 + .../1.7.0/kotlinforforge-1.7.0-sources.jar.sha1 | 1 + .../kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar | Bin 0 -> 112978 bytes .../1.7.0/kotlinforforge-1.7.0.jar.md5 | 1 + .../1.7.0/kotlinforforge-1.7.0.jar.sha1 | 1 + .../kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom | 53 +++++++++++++++++++++ .../1.7.0/kotlinforforge-1.7.0.pom.md5 | 1 + .../1.7.0/kotlinforforge-1.7.0.pom.sha1 | 1 + thedarkcolour/kotlinforforge/1.7.0/web.html | 20 ++++++++ thedarkcolour/kotlinforforge/maven-metadata.xml | 3 +- thedarkcolour/kotlinforforge/web.html | 1 + 18 files changed, 119 insertions(+), 9 deletions(-) create mode 100644 thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar create mode 100644 thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar.md5 create mode 100644 thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar.sha1 create mode 100644 thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar create mode 100644 thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar.md5 create mode 100644 thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar.sha1 create mode 100644 thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom create mode 100644 thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom.md5 create mode 100644 thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.pom.sha1 create mode 100644 thedarkcolour/kotlinforforge/1.7.0/web.html diff --git a/README.md b/README.md index 5286523..6d5b82d 100644 --- a/README.md +++ b/README.md @@ -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(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(private val clientValue: () -> T, private val ser public data class ObjectHolderDelegate>( private val registryName: ResourceLocation, private val registry: IForgeRegistry<*>, -) : ReadOnlyProperty, Consumer>, Supplier { +) : ReadOnlyProperty, Consumer>, Supplier, () -> 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>( 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>( } } + /** * Adds a registry object to this deferred registry. * @@ -56,7 +57,7 @@ public class KDeferredRegister>( * * @return A new [ObjectHolderDelegate] with the given registry name and value */ - public fun register(name: String, supplier: () -> T): ReadOnlyProperty { + public fun registerObject(name: String, supplier: () -> T): ObjectHolderDelegate { val key = ResourceLocation(modid, name) val a = ObjectHolderDelegate(key, registry) @@ -65,6 +66,17 @@ public class KDeferredRegister>( 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 register(name: String, supplier: () -> T): ReadOnlyProperty { + return registerObject(name, supplier) + } + public fun getEntries(): Set> { 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 new file mode 100644 index 0000000..d921415 Binary files /dev/null and b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0-sources.jar differ 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 new file mode 100644 index 0000000..899c2e3 Binary files /dev/null and b/thedarkcolour/kotlinforforge/1.7.0/kotlinforforge-1.7.0.jar differ 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 @@ + + + 4.0.0 + thedarkcolour + kotlinforforge + 1.7.0 + + + org.jetbrains.kotlin + kotlin-stdlib + 1.4.21 + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk7 + 1.4.21 + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + 1.4.21 + compile + + + org.jetbrains.kotlin + kotlin-reflect + 1.4.21 + compile + + + org.jetbrains + annotations + 20.1.0 + compile + + + org.jetbrains.kotlinx + kotlinx-coroutines-core + 1.4.2 + compile + + + org.jetbrains.kotlinx + kotlinx-coroutines-jdk8 + 1.4.2 + compile + + + 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 @@ + + +Index of /1.7.0/ + +

Index of /kotlinforforge/

+
+
../
+kotlinforforge-1.7.0-sources.jar
+kotlinforforge-1.7.0-sources.jar.sha1
+kotlinforforge-1.7.0-sources.jar.md5
+kotlinforforge-1.7.0.jar
+kotlinforforge-1.7.0.jar.sha1
+kotlinforforge-1.7.0.jar.md5
+kotlinforforge-1.7.0.pom
+kotlinforforge-1.7.0.pom.sha1
+kotlinforforge-1.7.0.pom.md5
+
+
+ + 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 @@ thedarkcolour kotlinforforge - 1.6.2 + 1.7.0 1.0.0 1.0.1 @@ -19,6 +19,7 @@ 1.6.0 1.6.1 1.6.2 + 1.7.0 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 @@ 1.6.0 1.6.1 1.6.2 +1.7.0 maven-metadata.xml maven-metadata.xml.md5 maven-metadata.xml.sha1 -- cgit