From 6cc5df1855f96999b1d24b61972330c6bf6d0b68 Mon Sep 17 00:00:00 2001 From: Bibi Reden Date: Tue, 6 Aug 2024 18:26:27 -0500 Subject: [PATCH] HOTFIX FOR NEWER DATA ATTRIBUTES --- CHANGELOG.md | 6 +++--- gradle.properties | 6 +++--- .../playerex/components/player/PlayerDataComponent.kt | 2 +- .../com/bibireden/playerex/factory/PlaceholderFactory.kt | 4 +++- src/main/resources/fabric.mod.json | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b6e2494..ddeea88b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ ## Changes 🌽 -- Fixed out-of-bounds exception when registering a menu. -- Renamed `rootComponent` in `MenuComponent` -> `screenRoot` to refer to the actual screens root. - - If you plan on using this component, know that you can access the functions/members you need directly from the object itself. \ No newline at end of file +- Uses the latest DataAttributes (beta.9) & OfflinePlayerCache. + - The namespace of DataAttributes got changed on this update, breaking the ability to use the mod with the latest one. This has been addressed now. +- This patches an issue when updating modifiers (for I forgot to update PlayerEX when changing namespaces.) \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ec0ee8b7..894d140f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ parchment_version=1.20.1:2023.09.03 quilt_mappings_version=23 # Mod Properties -mod_version=4.0.0+1.20.1-alpha.11 +mod_version=4.0.0+1.20.1-alpha.12 maven_group=com.bibireden.playerex archives_base_name=playerex-directors-cut @@ -30,8 +30,8 @@ placeholder_api_version=2.1.1+1.20 ranged_weapon_api_version=1.1.2+1.20.1 # in-house -opc_version=2.0.0+1.20.1-beta.2-fabric -data_attributes_version=2.0.0-beta.8+1.20.1-fabric +opc_version=2.0.0+1.20.1-beta.4-fabric +data_attributes_version=2.0.0+1.20.1-beta.9-fabric # owo owo_version=0.11.2+1.20 diff --git a/src/main/kotlin/com/bibireden/playerex/components/player/PlayerDataComponent.kt b/src/main/kotlin/com/bibireden/playerex/components/player/PlayerDataComponent.kt index 62c02de9..bcad87c6 100644 --- a/src/main/kotlin/com/bibireden/playerex/components/player/PlayerDataComponent.kt +++ b/src/main/kotlin/com/bibireden/playerex/components/player/PlayerDataComponent.kt @@ -81,7 +81,7 @@ class PlayerDataComponent( private fun trySet(key: ResourceLocation, value: Double): Boolean { val (instance, isPlayerEXModifierPresent) = this.getInstance(key) ?: return false if (isPlayerEXModifierPresent) { - (instance as IEntityAttributeInstance).updateModifier(PlayerEXModifiers.UUID, value) + instance.`data_attributes$updateModifier`(PlayerEXModifiers.UUID, value) } else { instance.addPermanentModifier(AttributeModifier(PlayerEXModifiers.UUID, "PlayerEX Attribute", value, AttributeModifier.Operation.ADDITION)) diff --git a/src/main/kotlin/com/bibireden/playerex/factory/PlaceholderFactory.kt b/src/main/kotlin/com/bibireden/playerex/factory/PlaceholderFactory.kt index d73c3502..3b5a66e2 100644 --- a/src/main/kotlin/com/bibireden/playerex/factory/PlaceholderFactory.kt +++ b/src/main/kotlin/com/bibireden/playerex/factory/PlaceholderFactory.kt @@ -1,8 +1,10 @@ package com.bibireden.playerex.factory import com.bibireden.opc.api.OfflinePlayerCacheAPI +import com.bibireden.opc.api.ext.getEntry import com.bibireden.playerex.PlayerEX import com.bibireden.playerex.api.PlayerEXCachedKeys +import com.bibireden.playerex.api.PlayerEXCachedKeys.Level import com.bibireden.playerex.ext.level import eu.pb4.placeholders.api.PlaceholderHandler import eu.pb4.placeholders.api.PlaceholderResult @@ -24,7 +26,7 @@ object PlaceholderFactory { var i = 0 for (name: String in namesIn) { - cache.getEntry(PlayerEXCachedKeys.Level::class.java, name).ifPresent { + cache.getEntry(name).ifPresent { names[i] = Pair(name, it.level) i++ } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d6054164..31f768b4 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -45,7 +45,7 @@ "java": ">=17", "fabric-api": "*", "fabric-language-kotlin": ">=1.10.19+kotlin.1.9.23", - "data_attributes": ">=2.0.0-beta.7+1.20.1-fabric", + "data_attributes": ">=2.0.0+1.20.1-beta.9-fabric", "ranged_weapon_api": ">=1.1.0+1.20.1" }, "custom": { @@ -60,7 +60,7 @@ "dependencies": [ "fabric-api@>=0.92.2+1.20.1(required){modrinth:P7dR8mSH}{curseforge:306612}#(ignore:github)", "fabric-language-kotlin@>=1.9.5+kotlin.1.8.22(required){modrinth:Ha28R6CL}{curseforge:308769}#(ignore:github)", - "data-attributes-directors-cut@>=2.0.0-beta.7+1.20.1-fabric(required){modrinth:KCGxOJsE}{curseforge:955929}#(ignore:github)", + "data-attributes-directors-cut@>=2.0.0+1.20.1-beta.9-fabric(required){modrinth:KCGxOJsE}{curseforge:955929}#(ignore:github)", "owo-lib@0.11.2(required){modrinth:ccKDOlHs}{curseforge:532610}#(ignore:github)", "ranged_weapon_api@>=1.1.0+1.20.1(required){modrinth:AqaIIO6D}{curseforge:962162}#(ignore:github)", "cardinal-components@5.2.2(embedded){modrinth:K01OU20C}{curseforge:318449}#(ignore:github)",