aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/gui/entity/ModifyWither.kt
blob: a0ddcddcb9fed52fdf681e813c09d8c4a2184e4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

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
    }

}