{
	"format_version": "1.10.0",
	"minecraft:client_entity": {
		"description": {
			"identifier": "shapescape_mb:sculkpion_boss",
			"materials": {
				"default": "entity_emissive_alpha"
			},
			"textures": {
				"default": "textures/shapescape/mb/entity/sculkpion_boss"
			},
			"geometry": {
				"default": "geometry.shapescape_mb.sculkpion_boss"
			},
			"animations": {
				"ac.general": "controller.animation.shapescape_mb.sculkpion_boss.general",
				"ac.idle_walk": "controller.animation.shapescape_mb.sculkpion_boss.idle_walk",
				"ac.hide_spikes": "controller.animation.shapescape_mb.sculkpion_boss.hide_spikes",
				"ac.hide_boom": "controller.animation.shapescape_mb.sculkpion_boss.hide_boom",
				"ac.hide_magic_circle": "controller.animation.shapescape_mb.sculkpion_boss.hide_magic_circle",

				"smash": "animation.shapescape_mb.sculkpion_boss.smash",
				"walk": "animation.shapescape_mb.sculkpion_boss.walk",
				"idle": "animation.shapescape_mb.sculkpion_boss.idle",
				"attack_left": "animation.shapescape_mb.sculkpion_boss.attack_left",
				"attack_right": "animation.shapescape_mb.sculkpion_boss.attack_right",
				"projectile": "animation.shapescape_mb.sculkpion_boss.projectile",
				"spawn": "animation.shapescape_mb.sculkpion_boss.spawn",
				"hide_spikes": "animation.shapescape_mb.sculkpion_boss.hide_spikes",
				"hide_boom": "animation.shapescape_mb.sculkpion_boss.hide_boom",
				"rotate_towards_target": "animation.shapescape_mb.sculkpion_boss.rotate_towards_target",
				"summon": "animation.shapescape_mb.sculkpion_boss.summon",
				"hide_magic_circle": "animation.shapescape_mb.sculkpion_boss.hide_magic_circle",
				"death": "animation.shapescape_mb.sculkpion_boss.death"
			},
			"scripts": {
				"initialize": [
					"v.custom_y_rotation = q.body_y_rotation;",
					"v.smash_attack_y_rotation = q.body_y_rotation;",
					"v.is_smash_attacking = 0;"
				],
				"pre_animation": [
					"t.is_smash_attacking = q.property('shapescape_mb:sculkpion_state') == 'smash';",
					"t.should_snap_aim = q.property('shapescape_mb:sculkpion_state') == 'projectile';",
					// If 'is_smash_attacking' changes from 0 to 1, save the current body rotation
					"v.smash_attack_y_rotation = t.is_smash_attacking == 1.0 && v.is_smash_attacking == 0.0 ? q.property('shapescape_mb:smash_body_rotation') : v.smash_attack_y_rotation;",
					"v.is_smash_attacking = t.is_smash_attacking;",

					// Result rotation before smoothing
					"t.custom_y_rotation = v.is_smash_attacking ? v.smash_attack_y_rotation : q.target_y_rotation+q.body_y_rotation;",
					// Smoothed rotation
					// Framerate-independent lerp smoothing: https://www.youtube.com/watch?v=LSNQuFEDOyQ
					"v.custom_y_rotation = math.lerprotate(v.custom_y_rotation, t.custom_y_rotation, math.exp(-2 * q.delta_time));",
					"v.custom_y_rotation = t.should_snap_aim ? q.target_y_rotation+q.body_y_rotation : v.custom_y_rotation;"
				],
				"animate": [
					"ac.general",
					"ac.hide_spikes",
					"ac.hide_boom",
					"ac.hide_magic_circle",
					"rotate_towards_target"
				]
			},
			"particle_effects": {
				"sculkpion_shockwave": "shapescape_mb:sculkpion_shockwave",
				"sculkpion_death_charge": "shapescape_mb:sculkpion_death_charge"
			},
			"render_controllers": [
				"controller.render.shapescape_mb.sculkpion_boss",
				"controller.render.shapescape_mb.sculkpion_boss_magic_circle"
			],
			"spawn_egg": {
				"base_color": "#3b0b0b",
				"overlay_color": "#000000"
			}
		}
	}
}
