aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/gui/entity/ModifyWither.kt
blob: 6083d8863815fdeebf49bbeadf3f7e36af43f595 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package moe.nea.firmament.gui.entity

import com.google.gson.JsonObject
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.boss.WitherEntity

object ModifyWither : EntityModifier {
    override fun apply(entity: LivingEntity, info: JsonObject): LivingEntity {
        require(entity is WitherEntity)
        info["tiny"]?.let {
            entity.setInvulTimer(if (it.asBoolean) 800 else 0)
        }
        info["armored"]?.let {
            entity.health = if (it.asBoolean) 1F else entity.maxHealth
        }
        return entity
    }

}