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> eid) {
        super(eid);
    }
    
    @Override
    public void render(final PoseStack dhl, final MultiBufferSource ebz, final int integer, final T aom, final float float5, final float float6, final float float7, final float float8, final float float9, final float float10) {
        if (!((PowerableMob)aom).isPowered()) {
            return;
        }
        final float float11 = ((Entity)aom).tickCount + float7;
        final EntityModel<T> dvv13 = this.model();
        dvv13.prepareMobModel(aom, float5, float6, float7);
        this.getParentModel().copyPropertiesTo(dvv13);
        final VertexConsumer dhp14 = ebz.getBuffer(RenderType.energySwirl(this.getTextureLocation(), this.xOffset(float11), float11 * 0.01f));
        dvv13.setupAnim(aom, float5, float6, float8, float9, float10);
        dvv13.renderToBuffer(dhl, dhp14, 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();
}
