package com.gameminers.farrago.block;

import java.util.ArrayList;
import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityReddustFX;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import com.gameminers.farrago.FarragoMod;
import com.google.common.collect.Lists;

public class BlockGlow extends Block {

	public BlockGlow() {
		super(Material.circuits);
		setCreativeTab(null);
		setHardness(0.0f);
		setResistance(0.0f);
		setStepSound(soundTypeCloth);
		setBlockName("glow");
		setBlockTextureName("farrago:blank");
		setLightLevel(0.9f);
	}
	
	@Override
	public boolean isOpaqueCube() {
		return false;
	}
	
	@Override
	public boolean isNormalCube() {
		return false;
	}
	
	@Override
	public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
        return null;
    }
	
	@Override
	public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
		float x1, y1, z1, x2, y2, z2;
		switch (world.getBlockMetadata(x, y, z)) {
		case 0:
			// top
			x1 = 0.0f;
			y1 = 0.9f;
			z1 = 0.0f;
			x2 = 1.0f;
			y2 = 1.0f;
			z2 = 1.0f;
			break;
		case 1:
			// bottom
			x1 = 0.0f;
			y1 = 0.0f;
			z1 = 0.0f;
			x2 = 1.0f;
			y2 = 0.1f;
			z2 = 1.0f;
			break;
		case 3:
			// west (+Z)
			x1 = 0.0f;
			y1 = 0.0f;
			z1 = 0.0f;
			x2 = 1.0f;
			y2 = 1.0f;
			z2 = 0.1f;
			break;
		case 2:
			// east (-Z)
			x1 = 0.0f;
			y1 = 0.0f;
			z1 = 0.9f;
			x2 = 1.0f;
			y2 = 1.0f;
			z2 = 1.0f;
			break;
		case 5:
			// south (+X)
			x1 = 0.0f;
			y1 = 0.0f;
			z1 = 0.0f;
			x2 = 0.1f;
			y2 = 1.0f;
			z2 = 1.0f;
			break;
		case 4:
			// north (-X)
			x1 = 0.9f;
			y1 = 0.0f;
			z1 = 0.0f;
			x2 = 1.0f;
			y2 = 1.0f;
			z2 = 1.0f;
			break;
		default:
			x1 = y1 = z1 = 0.0f;
			x2 = y2 = z2 = 1.0f;
		}
		setBlockBounds(x1, y1, z1, x2, y2, z2);
	}
	
	@Override
	public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
		ArrayList<ItemStack> drops = Lists.newArrayList();
		drops.add(new ItemStack(FarragoMod.DUST, 1, 5));
		drops.add(new ItemStack(Items.glowstone_dust));
		return drops;
	}
	
	@Override
	public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
		float x1 = (float) getBlockBoundsMinX();
		float y1 = (float) getBlockBoundsMinY();
		float z1 = (float) getBlockBoundsMinZ();
		float x2 = (float) getBlockBoundsMaxX();
		float y2 = (float) getBlockBoundsMaxY();
		float z2 = (float) getBlockBoundsMaxZ();
		for (int i = 0; i < rand.nextInt(10)+5; i++) {
			Minecraft.getMinecraft().effectRenderer.addEffect(new EntityReddustFX(world, x+(x1+(rand.nextFloat()*x2)),
					y+(y1+(rand.nextFloat()*y2)), z+(z1+(rand.nextFloat()*z2)), 0.6f, 1.0f, 1.0f, 0.0f));
		}
	}

}

@@ -2475,24 +2475,70 @@
 dom rand) %7B%0A
+%09%09setBlockBoundsBasedOnState(world, x, y, z);%0A
 %09%09float x1 =

Fix glow particles appearing in weird places