Skip to content

Commit

Permalink
fix setValue of finalizeOnRead being implemented wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Dec 1, 2023
1 parent bbd593a commit 28a01ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ unified minecraft modding environment with support for legacy environments.
* Bukkit Derrivitives (at least paper)
* LiteLoader
* Sponge
* NilLoader

## Custom Loaders
yes, this is possible, see [PrcraftExampleMod](https://github.com/prcraft-minecraft/PrcraftExampleMod) and it's buildsrc dir.
Expand Down
12 changes: 5 additions & 7 deletions src/api/kotlin/xyz/wagyourtail/unimined/util/FinalizeOnRead.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ class FinalizeOnRead<T>(value: T) : ReadWriteProperty<Any?, T> {
if (finalized) {
throw IllegalStateException("Cannot set finalized property")
}
setValueIntl(value)
}

fun setValueIntl(value: T) {
if (finalized) {
throw IllegalStateException("Cannot set finalized property")
finalized = true
if (value is ReadWriteProperty<*, *>) {
(value as ReadWriteProperty<Any?, T>).setValue(thisRef, property, value)
} else {
this.value = value
}
this.value = value
}

fun setValueIntl(value: ReadWriteProperty<Any?, T>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ abstract class FabricLikeMinecraftTransformer(
innerjson.addProperty("name", dep.name)
val custom = JsonObject()
custom.addProperty("fabric-loom:generated", true)
custom.addProperty("unimined:generated", true)
innerjson.add("custom", custom)
Files.write(
innermod,
Expand Down

0 comments on commit 28a01ca

Please sign in to comment.