// Path: src/java/cd4017be/kineng/block/BlockRotaryTool.java
// public class BlockRotaryTool extends BlockShaft {
// 
// 	public double maxF;
// 	public final int type;
// 	public ItemStack scrap = ItemStack.EMPTY;
// 
// 	/**
// 	 * @param id
// 	 * @param m
// 	 * @param r
// 	 * @param tile
// 	 */
// 	public BlockRotaryTool(String id, ShaftMaterial m, int type, double r, Class<? extends TileEntity> tile) {
// 		super(id, m, r, tile);
// 		this.type = type;
// 	}
// 
// 	@Override
// 	public double J(IBlockState state) {
// 		return J_dens;
// 	}
// 
// 	@Override
// 	public double getDebris(IBlockState state, List<ItemStack> items) {
// 		items.add(shaftMat.scrap);
// 		items.add(scrap);
// 		return r;
// 	}
// 
// 	public void setMaterials(ShaftMaterial mat, double r, double h) {
// 		J_dens = Formula.J_biCylinder(0.25, shaftMat.density, r, mat.density, h);
// 		av_max = Math.min(
// 			Formula.rip_vel(shaftMat.strength / shaftMat.density, 0.25),
// 			Formula.rip_vel(mat.strength / mat.density, r)
// 		);
// 	}
// 
// 	@Override
// 	@SideOnly(Side.CLIENT)
// 	protected void addInformation(IBlockState state, List<String> tooltip, ITooltipFlag advanced) {
// 		super.addInformation(state, tooltip, advanced);
// 		tooltip.add(TooltipUtil.format("info.kineng.toolstats", radius(state), maxF));
// 	}
// 
// }


import cd4017be.kineng.block.BlockRotaryTool;
import cd4017be.kineng.physics.*;
import cd4017be.lib.block.AdvancedBlock.INeighborAwareTile;
import cd4017be.lib.util.Utils;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.Axis;
import net.minecraft.util.math.BlockPos;

	public double setShaft(ShaftAxis shaft, double v0) {
		v0 = IKineticLink.super.setShaft(shaft, vSave);
		this.shaft = shaft;
		return v0;
	}

	@Override
	public ForceCon getCon(EnumFacing side) {
		Axis a = axis();
		int d = (1 - (side.getAxis().ordinal() - a.ordinal() + 4) % 3)
			* side.getAxisDirection().getOffset();
		if (d == 0) return null;
		int i = side.ordinal();
		if (i >= 2 && a != Axis.X) i -= 2;
		ForceCon con = cons[i];
		if (con != null) return con;
		BlockRotaryTool block = block();
		con = new ForceCon(this, block.r * d);
		con.maxF = block.maxF;
		return cons[i] = con;
	}

	@Override
	public IForceProvider findLink(EnumFacing side) {
		TileEntity te = world.getTileEntity(pos.offset(side));
		return te instanceof IForceProvider ? (IForceProvider)te : null;
	}

	@Override
	public int type() {

// Path: src/java/cd4017be/kineng/block/BlockRotaryTool.java
// public class BlockRotaryTool extends BlockShaft {
// 
// 	public double maxF;
// 	public final int type;
// 	public ItemStack scrap = ItemStack.EMPTY;
// 
// 	/**
// 	 * @param id
// 	 * @param m
// 	 * @param r
// 	 * @param tile
// 	 */
// 	public BlockRotaryTool(String id, ShaftMaterial m, int type, double r, Class<? extends TileEntity> tile) {
// 		super(id, m, r, tile);
// 		this.type = type;
// 	}
// 
// 	@Override
// 	public double J(IBlockState state) {
// 		return J_dens;
// 	}
// 
// 	@Override
// 	public double getDebris(IBlockState state, List<ItemStack> items) {
// 		items.add(shaftMat.scrap);
// 		items.add(scrap);
// 		return r;
// 	}
// 
// 	public void setMaterials(ShaftMaterial mat, double r, double h) {
// 		J_dens = Formula.J_biCylinder(0.25, shaftMat.density, r, mat.density, h);
// 		av_max = Math.min(
// 			Formula.rip_vel(shaftMat.strength / shaftMat.density, 0.25),
// 			Formula.rip_vel(mat.strength / mat.density, r)
// 		);
// 	}
// 
// 	@Override
// 	@SideOnly(Side.CLIENT)
// 	protected void addInformation(IBlockState state, List<String> tooltip, ITooltipFlag advanced) {
// 		super.addInformation(state, tooltip, advanced);
// 		tooltip.add(TooltipUtil.format("info.kineng.toolstats", radius(state), maxF));
// 	}
// 
// }


// Path: src/java/cd4017be/kineng/tileentity/RotaryTool.java
import cd4017be.kineng.block.BlockRotaryTool;
import cd4017be.kineng.physics.*;
import cd4017be.lib.block.AdvancedBlock.INeighborAwareTile;
import cd4017be.lib.util.Utils;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.Axis;
import net.minecraft.util.math.BlockPos;

	public double setShaft(ShaftAxis shaft, double v0) {
		v0 = IKineticLink.super.setShaft(shaft, vSave);
		this.shaft = shaft;
		return v0;
	}

	@Override
	public ForceCon getCon(EnumFacing side) {
		Axis a = axis();
		int d = (1 - (side.getAxis().ordinal() - a.ordinal() + 4) % 3)
			* side.getAxisDirection().getOffset();
		if (d == 0) return null;
		int i = side.ordinal();
		if (i >= 2 && a != Axis.X) i -= 2;
		ForceCon con = cons[i];
		if (con != null) return con;
		BlockRotaryTool block = block();
		con = new ForceCon(this, block.r * d);
		con.maxF = block.maxF;
		return cons[i] = con;
	}

	@Override
	public IForceProvider findLink(EnumFacing side) {
		TileEntity te = world.getTileEntity(pos.offset(side));
		return te instanceof IForceProvider ? (IForceProvider)te : null;
	}

	@Override
	public int type() {

		return this.<BlockRotaryTool>block().type;
