aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/gui/entity/ModifyWither.kt
blob: 67252b8b22b261be3981df609e3b49b7f9259196 (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.world.entity.LivingEntity
import net.minecraft.world.entity.boss.wither.WitherBoss

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

}