package com.teamwizardry.refraction.common.effect;

import com.teamwizardry.refraction.api.Effect;
import com.teamwizardry.refraction.api.IBeamHandler;
import com.teamwizardry.refraction.api.ILightSource;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;

import java.awt.*;
import java.util.Set;

public class EffectBreak extends Effect {


	@Override
	public int getCooldown() {
		return potency == 0 ? 0 : 5550 / potency;
	}

	@Override
	public void run(World world, Set<BlockPos> locations) {
		if (beam.trace.typeOfHit != RayTraceResult.Type.BLOCK) return;

		TileEntity tile = world.getTileEntity(beam.trace.getBlockPos());
		if (tile != null)
			if (tile instanceof IBeamHandler || tile instanceof ILightSource) return;
		float hardness = world.getBlockState(beam.trace.getBlockPos()).getBlockHardness(world, beam.trace.getBlockPos());
		if (hardness >= 0 && hardness * 32 * 2 / 3 < potency)
			world.destroyBlock(beam.trace.getBlockPos(), true);
	}

	@Override
	public Color getColor() {
		return Color.YELLOW;
	}
}

@@ -223,29 +223,31 @@
 aft.
-tileentity.TileEntity
+block.state.IBlockState
 ;%0Aim
@@ -680,23 +680,25 @@
 %0A%0A%09%09
-TileEntity tile
+IBlockState block
  = w
@@ -709,18 +709,18 @@
 .get
-TileEntity
+BlockState
 (bea
@@ -753,33 +753,24 @@
 if (
-tile != null)%0A%09%09%09if (tile
+block.getBlock()
  ins
@@ -797,12 +797,24 @@
  %7C%7C 
-tile
+block.getBlock()
  ins
@@ -843,16 +843,17 @@
 return;%0A
+%0A
 %09%09float 

fix effectbreak not caring about blocks