package net.minecraft.client.renderer.entity.layers;

import net.minecraft.resources.ResourceLocation;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.PowerableMob;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.model.EntityModel;

public abstract class EnergySwirlLayer<T extends Entity, M extends EntityModel<T>> extends RenderLayer<T, M> {
    public EnergySwirlLayer(final RenderLayerParent<T, M> dwv) {
        super(dwv);
    }
    
    @Override
    public void render(final PoseStack cyl, final MultiBufferSource dqt, final int integer, final T akq, final float float5, final float float6, final float float7, final float float8, final float float9, final float float10) {
        if (!((PowerableMob)akq).isPowered()) {
            return;
        }
        final float float11 = ((Entity)akq).tickCount + float7;
        final EntityModel<T> dla13 = this.model();
        dla13.prepareMobModel(akq, float5, float6, float7);
        this.getParentModel().copyPropertiesTo(dla13);
        final VertexConsumer cyo14 = dqt.getBuffer(RenderType.energySwirl(this.getTextureLocation(), this.xOffset(float11), float11 * 0.01f));
        dla13.setupAnim(akq, float5, float6, float8, float9, float10);
        dla13.renderToBuffer(cyl, cyo14, integer, OverlayTexture.NO_OVERLAY, 0.5f, 0.5f, 0.5f, 1.0f);
    }
    
    protected abstract float xOffset(final float float1);
    
    protected abstract ResourceLocation getTextureLocation();
    
    protected abstract EntityModel<T> model();
}
