Skip to content

Commit

Permalink
Fix variant not saving to NBT data
Browse files Browse the repository at this point in the history
  • Loading branch information
seaneoo committed Nov 12, 2024
1 parent c349bbb commit 8cb0028
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/dev/seano/sgp/entity/GuineaPigEntity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ class GuineaPigEntity(entityType: EntityType<out TameableEntity>?, world: World?

override fun readCustomDataFromNbt(nbt: NbtCompound) {
super.readCustomDataFromNbt(nbt)
getVariant()?.let { nbt.putInt("Variant", it.id) }
GuineaPigVariant.byIndex(nbt.getInt("Variant"))?.let { setVariant(it) }
}

override fun writeCustomDataToNbt(nbt: NbtCompound) {
super.writeCustomDataToNbt(nbt)
GuineaPigVariant.byIndex(nbt.getInt("Variant"))?.let { setVariant(it) }
getVariant()?.let { nbt.putInt("Variant", it.id) }
}

override fun initialize(
Expand Down

0 comments on commit 8cb0028

Please sign in to comment.