package zmaster587.advancedRocketry.block.cable;

import java.util.Random;

import zmaster587.advancedRocketry.tile.cables.TileDataPipe;
import zmaster587.advancedRocketry.tile.cables.TilePipe;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockPipe extends Block {

	protected BlockPipe(Material material) {
		super(material);

	}

	@Override
	public boolean isNormalCube(IBlockState state, IBlockAccess world,
			BlockPos pos) {
		return false;
	}

	@Override
	public boolean isOpaqueCube(IBlockState state) {
		return false;
	}

	@Override
	public boolean isFullCube(IBlockState state) {
		return false;
	}

	@Override
	public boolean hasTileEntity(IBlockState state) {
		return true;
	}

	@Override
	public boolean shouldSideBeRendered(IBlockState blockState,
			IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
		return true;
	}

	@Override
	public void updateTick(World worldIn, BlockPos pos, IBlockState state,
			Random rand) {
		super.updateTick(worldIn, pos, state, rand);
		TilePipe pipe = ((TilePipe)worldIn.getTileEntity(pos));

		if (!pipe.isInitialized()) {
			pipe.onPlaced();
			pipe.markDirty();
		}
	}
	
	@Override
	public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state,
			EntityLivingBase placer, ItemStack stack) {
		((TilePipe)worldIn.getTileEntity(pos)).onPlaced();
	}


	@Override
	public TileEntity createTileEntity(World world, IBlockState state) {
		return new TileDataPipe();
	}

	@Override
	public void neighborChanged(IBlockState state, World worldIn, BlockPos pos,
			Block blockIn, BlockPos fromPos) {
		((TilePipe)worldIn.getTileEntity(pos)).onPlaced();
	}

	@Override
	public void onNeighborChange(IBlockAccess world, BlockPos pos,
			BlockPos neighbor) {
		((TilePipe)world.getTileEntity(pos)).onNeighborTileChange(neighbor);
	}


}
@@ -607,16 +607,62 @@
 umHand;%0A
+import net.minecraft.util.math.AxisAlignedBB;%0A
 import n
@@ -869,70 +869,287 @@
 %0A%09pr
-otected BlockPipe(Material material) %7B%0A%09%09super(material);%0A%0A%09%7D%0A
+ivate static AxisAlignedBB bb = new AxisAlignedBB(0.15, 0.15, 0.15, 0.85, 0.85, 0.85);%0A%09%0A%09protected BlockPipe(Material material) %7B%0A%09%09super(material);%0A%0A%09%7D%0A%0A%09@Override%0A%09public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source,%0A%09%09%09BlockPos pos) %7B%0A%09%09return bb;%0A%09%7D%0A%09
 %0A%09@O

fix bounding box on cables