aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/debug/AnimatedClothingScanner.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-11-17 19:55:02 +0100
committerLinnea Gräf <nea@nea.moe>2025-11-17 19:55:02 +0100
commitc93a04a001b0f66b2724d46b04b6d1ed49a08d07 (patch)
tree5869ca70acc482ef0362f27785c3d3f1cbb9ffae /src/main/kotlin/features/debug/AnimatedClothingScanner.kt
parentaf9893b59407c69d31ebd2ed513f0396ab4d2dc9 (diff)
downloadFirmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.gz
Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.bz2
Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.zip
refactor: port to mojmaps
Diffstat (limited to 'src/main/kotlin/features/debug/AnimatedClothingScanner.kt')
-rw-r--r--src/main/kotlin/features/debug/AnimatedClothingScanner.kt34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/main/kotlin/features/debug/AnimatedClothingScanner.kt b/src/main/kotlin/features/debug/AnimatedClothingScanner.kt
index 4edccfb..dc77115 100644
--- a/src/main/kotlin/features/debug/AnimatedClothingScanner.kt
+++ b/src/main/kotlin/features/debug/AnimatedClothingScanner.kt
@@ -1,13 +1,13 @@
package moe.nea.firmament.features.debug
-import net.minecraft.command.argument.RegistryKeyArgumentType
-import net.minecraft.component.ComponentType
-import net.minecraft.entity.Entity
-import net.minecraft.entity.decoration.ArmorStandEntity
-import net.minecraft.item.ItemStack
-import net.minecraft.nbt.NbtElement
+import net.minecraft.commands.arguments.ResourceKeyArgument
+import net.minecraft.core.component.DataComponentType
+import net.minecraft.world.entity.Entity
+import net.minecraft.world.entity.decoration.ArmorStand
+import net.minecraft.world.item.ItemStack
+import net.minecraft.nbt.Tag
import net.minecraft.nbt.NbtOps
-import net.minecraft.registry.RegistryKeys
+import net.minecraft.core.registries.Registries
import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.commands.get
import moe.nea.firmament.commands.thenArgument
@@ -27,11 +27,11 @@ object AnimatedClothingScanner {
data class LensOfFashionTheft<T>(
val prism: NbtPrism,
- val component: ComponentType<T>,
+ val component: DataComponentType<T>,
) {
- fun observe(itemStack: ItemStack): Collection<NbtElement> {
+ fun observe(itemStack: ItemStack): Collection<Tag> {
val x = itemStack.get(component) ?: return listOf()
- val nbt = component.codecOrThrow.encodeStart(NbtOps.INSTANCE, x).orThrow
+ val nbt = component.codecOrThrow().encodeStart(NbtOps.INSTANCE, x).orThrow
return prism.access(nbt)
}
}
@@ -115,16 +115,16 @@ object AnimatedClothingScanner {
)
)
val p = MC.player!!
- val nearestPet = p.world.getEntitiesByClass(
- ArmorStandEntity::class.java,
- p.boundingBox.expand(10.0),
+ val nearestPet = p.level.getEntitiesOfClass(
+ ArmorStand::class.java,
+ p.boundingBox.inflate(10.0),
{ it.isMarker })
- .minBy { it.squaredDistanceTo(p) }
+ .minBy { it.distanceToSqr(p) }
toggleObserve(nearestPet)
}
}
thenExecute {
- val ent = MC.instance.targetedEntity
+ val ent = MC.instance.crosshairPickEntity
if (ent == null) {
source.sendFeedback(
tr(
@@ -140,7 +140,7 @@ object AnimatedClothingScanner {
thenLiteral("path") {
thenArgument(
"component",
- RegistryKeyArgumentType.registryKey(RegistryKeys.DATA_COMPONENT_TYPE)
+ ResourceKeyArgument.key(Registries.DATA_COMPONENT_TYPE)
) { component ->
thenArgument("path", NbtPrism.Argument) { path ->
thenExecute {
@@ -151,7 +151,7 @@ object AnimatedClothingScanner {
source.sendFeedback(
tr(
"firmament.fitstealer.lensset",
- "Analyzing path ${get(path)} for component ${get(component).value}"
+ "Analyzing path ${get(path)} for component ${get(component).location()}"
)
)
}