aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/features')
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/AotvHighlight.kt13
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/BrokenHyp.kt9
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/CooldownDisplays.kt5
3 files changed, 13 insertions, 14 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/features/AotvHighlight.kt b/src/main/kotlin/com/dulkirfabric/features/AotvHighlight.kt
index 5cce244..5b1a81d 100644
--- a/src/main/kotlin/com/dulkirfabric/features/AotvHighlight.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/AotvHighlight.kt
@@ -10,7 +10,9 @@ import com.dulkirfabric.util.render.WorldRenderUtils
import meteordevelopment.orbit.EventHandler
import net.minecraft.client.MinecraftClient
import net.minecraft.client.util.InputUtil
+import net.minecraft.component.DataComponentTypes
import net.minecraft.entity.Entity
+import net.minecraft.nbt.NbtString
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.hit.HitResult
import net.minecraft.util.math.BlockPos
@@ -29,14 +31,9 @@ object AotvHighlight {
fun getHeldItemID(): String {
val stack = mc.player?.mainHandStack ?: return ""
- val tag = stack.nbt ?: return ""
- val id = tag.getCompound("ExtraAttributes").get("id") ?: return ""
- return id.toString().trim('"')
- }
-
- @EventHandler
- fun onLong(event: LongUpdateEvent) {
- //println(heldItemID)
+ val tag = stack.get(DataComponentTypes.CUSTOM_DATA)?.nbt ?: return ""
+ val id = tag.get("id") as? NbtString ?: return ""
+ return id.asString()
}
@EventHandler
diff --git a/src/main/kotlin/com/dulkirfabric/features/BrokenHyp.kt b/src/main/kotlin/com/dulkirfabric/features/BrokenHyp.kt
index 85c1f7b..713a9d1 100644
--- a/src/main/kotlin/com/dulkirfabric/features/BrokenHyp.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/BrokenHyp.kt
@@ -6,6 +6,7 @@ import com.dulkirfabric.events.LongUpdateEvent
import com.dulkirfabric.util.TablistUtils
import com.dulkirfabric.util.render.HudRenderUtil
import meteordevelopment.orbit.EventHandler
+import net.minecraft.component.DataComponentTypes
import net.minecraft.item.ItemStack
import net.minecraft.text.Style
import net.minecraft.text.Text
@@ -29,11 +30,11 @@ object BrokenHyp {
val stack: ItemStack = mc.player?.mainHandStack ?: return
// get info about held item
- val tag = stack.nbt ?: return
- id = tag.getCompound("ExtraAttributes")?.getString("id") ?: ""
+ val tag = stack.get(DataComponentTypes.CUSTOM_DATA)?.nbt ?: return
+ id = tag.getString("id") ?: ""
- kill = tag.getCompound("ExtraAttributes")?.getInt("stats_book") ?: -1
- championXp = tag.getCompound("ExtraAttributes")?.getDouble("champion_combat_xp") ?: -1.0
+ kill = tag.getInt("stats_book") ?: -1
+ championXp = tag.getDouble("champion_combat_xp") ?: -1.0
// check if a wither blade, then check if same id
if (!(id matches "(HYPERION|ASTRAEA|SCYLLA|VALKYRIE)".toRegex())) {
diff --git a/src/main/kotlin/com/dulkirfabric/features/CooldownDisplays.kt b/src/main/kotlin/com/dulkirfabric/features/CooldownDisplays.kt
index 0476d51..e562a2e 100644
--- a/src/main/kotlin/com/dulkirfabric/features/CooldownDisplays.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/CooldownDisplays.kt
@@ -8,6 +8,7 @@ import com.dulkirfabric.util.TrackedCooldown
import com.dulkirfabric.util.Utils
import meteordevelopment.orbit.EventHandler
import net.minecraft.client.sound.Sound
+import net.minecraft.component.DataComponentTypes
import net.minecraft.item.ItemStack
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
import kotlin.math.round
@@ -89,8 +90,8 @@ object CooldownDisplays {
}
private fun fetchCooldownItem(stack: ItemStack): TrackedCooldown? {
- val tag = stack.nbt ?: return null
- val id = tag.getCompound("ExtraAttributes").get("id") ?: return null
+ val tag = stack.get(DataComponentTypes.CUSTOM_DATA)?.nbt ?: return null
+ val id = tag.get("id") ?: return null
val idStr = id.toString().trim('"')
trackedCooldowns.forEach {
if (idStr matches it.value.itemID)