Skip to content

Commit

Permalink
Change SetEntityType to value class
Browse files Browse the repository at this point in the history
  • Loading branch information
0ffz committed Dec 26, 2023
1 parent 2796d04 commit 5351bcf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ package com.mineinabyss.geary.papermc.tracking.entities.components
import com.mineinabyss.idofront.nms.aliases.NMSEntityType
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
import net.minecraft.world.entity.EntityType

@JvmInline
@Serializable
@SerialName("geary:set.entity_type")
class SetEntityType(
private val key: String,
// TODO support this via custom entity types in the future
// val mobCategory: MobCategory? = null,
) {
@Transient
val entityTypeFromRegistry: EntityType<*> = NMSEntityType
.byString(key)
.orElseGet { error("An entity type with key $key was not found.") }
value class SetEntityType(val key: String) {
val entityTypeFromRegistry: EntityType<*>
get() = NMSEntityType
.byString(key)
.orElseGet { error("An entity type with key $key was not found.") }
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ kotlin.code.style=official
group=com.mineinabyss
version=0.28
idofrontVersion=0.20.14
gearyVersion=0.24.1
gearyVersion=0.24.2

0 comments on commit 5351bcf

Please sign in to comment.