package net.minecraft.client.particle;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import net.minecraft.client.renderer.texture.TextureAtlas;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.Tesselator;
import net.minecraft.client.renderer.texture.TextureManager;
import com.mojang.blaze3d.vertex.BufferBuilder;

public interface ParticleRenderType {
    public static final ParticleRenderType TERRAIN_SHEET = new ParticleRenderType() {
        @Override
        public void begin(final BufferBuilder cyg, final TextureManager eak) {
            RenderSystem.enableBlend();
            RenderSystem.defaultBlendFunc();
            RenderSystem.depthMask(true);
            eak.bind(TextureAtlas.LOCATION_BLOCKS);
            cyg.begin(7, DefaultVertexFormat.PARTICLE);
        }
        
        @Override
        public void end(final Tesselator cym) {
            cym.end();
        }
        
        @Override
        public String toString() {
            return "TERRAIN_SHEET";
        }
    };
    public static final ParticleRenderType PARTICLE_SHEET_OPAQUE = new ParticleRenderType() {
        @Override
        public void begin(final BufferBuilder cyg, final TextureManager eak) {
            RenderSystem.disableBlend();
            RenderSystem.depthMask(true);
            eak.bind(TextureAtlas.LOCATION_PARTICLES);
            cyg.begin(7, DefaultVertexFormat.PARTICLE);
        }
        
        @Override
        public void end(final Tesselator cym) {
            cym.end();
        }
        
        @Override
        public String toString() {
            return "PARTICLE_SHEET_OPAQUE";
        }
    };
    public static final ParticleRenderType PARTICLE_SHEET_TRANSLUCENT = new ParticleRenderType() {
        @Override
        public void begin(final BufferBuilder cyg, final TextureManager eak) {
            RenderSystem.depthMask(true);
            eak.bind(TextureAtlas.LOCATION_PARTICLES);
            RenderSystem.enableBlend();
            RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
            RenderSystem.alphaFunc(516, 0.003921569f);
            cyg.begin(7, DefaultVertexFormat.PARTICLE);
        }
        
        @Override
        public void end(final Tesselator cym) {
            cym.end();
        }
        
        @Override
        public String toString() {
            return "PARTICLE_SHEET_TRANSLUCENT";
        }
    };
    public static final ParticleRenderType PARTICLE_SHEET_LIT = new ParticleRenderType() {
        @Override
        public void begin(final BufferBuilder cyg, final TextureManager eak) {
            RenderSystem.disableBlend();
            RenderSystem.depthMask(true);
            eak.bind(TextureAtlas.LOCATION_PARTICLES);
            cyg.begin(7, DefaultVertexFormat.PARTICLE);
        }
        
        @Override
        public void end(final Tesselator cym) {
            cym.end();
        }
        
        @Override
        public String toString() {
            return "PARTICLE_SHEET_LIT";
        }
    };
    public static final ParticleRenderType CUSTOM = new ParticleRenderType() {
        @Override
        public void begin(final BufferBuilder cyg, final TextureManager eak) {
            RenderSystem.depthMask(true);
            RenderSystem.disableBlend();
        }
        
        @Override
        public void end(final Tesselator cym) {
        }
        
        @Override
        public String toString() {
            return "CUSTOM";
        }
    };
    public static final ParticleRenderType NO_RENDER = new ParticleRenderType() {
        @Override
        public void begin(final BufferBuilder cyg, final TextureManager eak) {
        }
        
        @Override
        public void end(final Tesselator cym) {
        }
        
        @Override
        public String toString() {
            return "NO_RENDER";
        }
    };
    
    void begin(final BufferBuilder cyg, final TextureManager eak);
    
    void end(final Tesselator cym);
}
