package ru.dbotthepony.mc.otm.client.render.entity
import net.minecraft.client.model.HumanoidModel
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.core.ResourceLocation

import net.minecraft.client.model.PlayerModel
import net.minecraft.client.renderer.entity.EntityRendererProvider
import net.minecraft.client.renderer.entity.HumanoidMobRenderer
import net.minecraft.client.model.geom.ModelLayers
import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer
import net.minecraft.client.renderer.entity.layers.ItemInHandLayer
import net.minecraft.client.resources.model.ModelManager

import net.minecraft.resources.ResourceLocation
import net.minecraft.world.entity.EntityType
import net.minecraft.world.entity.Mob


class RogueAndroidRenderer<T : Mob>(context: EntityRendererProvider.Context, private val entityType: EntityType<T>, private val androidTexture: String,private val modelManager: ModelManager) :
	HumanoidMobRenderer<T, PlayerModel<T>>(
		context, PlayerModel(context.bakeLayer(ModelLayers.PLAYER), false), 0.5f
	) {

	init {
		addLayer(ItemInHandLayer(this, context.itemInHandRenderer))
		addLayer(
			HumanoidArmorLayer(
				this,
				HumanoidModel(context.bakeLayer(ModelLayers.PLAYER_INNER_ARMOR)),
				HumanoidModel(context.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)),
				modelManager
			)
		)
	}

	override fun getTextureLocation(entity: T): ResourceLocation {
		return ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/entity/android/$androidTexture.png")
	}
}
