package org.soraworld.sniffer.gui;

import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.soraworld.sniffer.BlockSniffer;
import org.soraworld.sniffer.api.SnifferAPI;

import java.awt.*;

@SideOnly(Side.CLIENT)
public class ParticleEffect {

    private final SnifferAPI api = BlockSniffer.getAPI();

    public void spawn(World worldObj, double fromX, double fromY, double fromZ, double toX, double toY, double toZ, Color color) {
        spawnSingleParticle(worldObj, 0.5D + toX, 0.5D + toY, 0.5D + toZ, 1.0F, color, 0.0D, 0.0D, 0.0D);
        intSpawnParticleTrail(worldObj, fromX, fromY, fromZ, toX + 0.5D, toY + 0.5D, toZ + 0.5D, color);
    }

    private void intSpawnParticleTrail(World theWorld, double fromX, double fromY, double fromZ, double toX, double toY, double toZ, Color color) {
        double dx = toX - fromX;
        double dy = toY - fromY;
        double dz = toZ - fromZ;
        double steps = Math.max(Math.abs(dx), Math.max(Math.abs(dy), Math.abs(dz))) * 3.0D;
        double dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
        double strength = 0.8D;
        double ds = strength / 30.0D;
        double vx = dx / dist * 0.015D;
        double vy = dy / dist * 0.015D;
        double vz = dz / dist * 0.015D;

        for (int i = 0; i < steps; ++i) {
            double x = fromX + dx / steps * i;
            double y = fromY + dy / steps * i;
            double z = fromZ + dz / steps * i;
            strength -= ds;
            if (strength < 0.2D) {
                strength = 0.2D;
            }
            spawnSingleParticle(theWorld, x, y, z, (float) strength, color, vx, vy, vz);
        }
    }

    private void spawnSingleParticle(World theWorld, double x, double y, double z, float alpha, Color color, double vx, double vy, double vz) {
        api.mc.effectRenderer.addEffect(new ParticleFX(theWorld, x, y, z, vx, vy, vz, color, alpha));
    }
}

@@ -29,16 +29,55 @@
 r.gui;%0A%0A
+import net.minecraft.client.Minecraft;%0A
 import n
@@ -102,16 +102,16 @@
 .World;%0A
-
 import n
@@ -203,96 +203,8 @@
 nly;
-%0Aimport org.soraworld.sniffer.BlockSniffer;%0Aimport org.soraworld.sniffer.api.SnifferAPI;
 %0A%0Aim
@@ -291,50 +291,58 @@
 ate 
-final SnifferAPI api = BlockSniffer.getAPI
+static final Minecraft mc = Minecraft.getMinecraft
 ();%0A
@@ -1838,12 +1838,8 @@
     
-api.
 mc.e

revert mc