Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
Fix error when categorizing entity not tracked by geary
Browse files Browse the repository at this point in the history
  • Loading branch information
0ffz committed Dec 2, 2023
1 parent d6923e1 commit c3b007c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mineinabyss.mobzy.spawning.vertical

import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull
import com.mineinabyss.geary.prefabs.PrefabKey
import com.mineinabyss.geary.prefabs.helpers.prefabs
import com.mineinabyss.idofront.location.down
Expand Down Expand Up @@ -84,7 +85,7 @@ class SpawnInfo(
companion object {
//TODO perhaps give normal mobs prefab keys too to make this more type safe
fun categorizeByType(mobs: Collection<Entity>): Map<PrefabKey?, Int> =
mobs.groupingBy { it.toGeary().prefabs.firstOrNull()?.get<PrefabKey>() }.eachCount()
mobs.groupingBy { it.toGearyOrNull()?.prefabs?.firstOrNull()?.get<PrefabKey>() }.eachCount()
}
}

0 comments on commit c3b007c

Please sign in to comment.