Skip to content

Commit

Permalink
Fix deadlocking issue with carpet
Browse files Browse the repository at this point in the history
  • Loading branch information
senseiwells committed Jan 7, 2025
1 parent a89d2c6 commit 4ff0965
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
7 changes: 5 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ repositories {
maven("https://maven.supersanta.me/snapshots")
maven("https://api.modrinth.com/maven")
maven("https://jitpack.io")
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
}

val modVersion = "2.1.1"
val modVersion = "2.1.2"
val releaseVersion = "${modVersion}+${libs.versions.minecraft.get()}"
version = releaseVersion
group = "me.senseiwells"
Expand All @@ -45,6 +46,8 @@ dependencies {
modCompileOnly(libs.carpet)
modCompileOnly(libs.chunk.debug)
modCompileOnly(libs.sodium)

modRuntimeOnly(libs.dev.auth)
}

java {
Expand All @@ -71,7 +74,7 @@ tasks {
publishMods {
file = remapJar.get().archiveFile
changelog = """
- Fixed remapping issue causing a crash when opening a world
- Fixed deadlocking issue with Carpet
""".trimIndent()
type = STABLE
modLoaders.add("fabric")
Expand Down
8 changes: 7 additions & 1 deletion libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ yacl = "3.6.2+1.21.4-fabric"

# Compatability
mod-menu = "13.0.0-beta.1"
carpet = "1.4.160"
carpet = "1.4.161"
chunk-debug = "2.1.3+1.21.4"
sodium = "mc1.21.4-0.6.6-fabric"

# Runtime
dev-auth = "1.2.1"

# Plugins
fabric-loom = "1.9-SNAPSHOT"
mod-publish = "0.8.1"
Expand All @@ -31,6 +34,9 @@ carpet = { module = "com.github.gnembon:fabric-carpet" , version.r
chunk-debug = { module = "me.senseiwells:chunk-debug" , version.ref = "chunk-debug" }
sodium = { module = "maven.modrinth:sodium" , version.ref = "sodium" }

# Runtime
dev-auth = { module = "me.djtheredstoner:DevAuth-fabric" , version.ref = "dev-auth" }

[plugins]
fabric-loom = { id = "fabric-loom" , version.ref = "fabric-loom" }
mod-publish = { id = "me.modmuss50.mod-publish-plugin", version.ref = "mod-publish" }
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ object CarpetRulesDatabase {
if (!CarpetClient.hasLocalCarpet) {
return rules
}
return rules.map(::resolveDataWithLocalCarpet)
// We push to the main thread because carpet may not be initialized yet...
return Minecraft.getInstance().submit(Supplier {
rules.map(::resolveDataWithLocalCarpet)
}).join()
}

private fun resolveDataWithLocalCarpet(data: CarpetRuleData): CarpetRuleData {
// We push to the main thread because carpet may not be initialized yet...
val rule = Minecraft.getInstance().submit(Supplier {
CarpetUtils.rules().find { it.matches(data) }
}).join()
val rule = CarpetUtils.rules().find { it.matches(data) }
if (rule != null) {
return data.copy(
type = CarpetOptionType.resolve(rule.type(), rule.categories()),
Expand Down

0 comments on commit 4ff0965

Please sign in to comment.