IPartItem bi = (IPartItem) is.getItem();
is = is.copy();
is.stackSize = 1;
IPart bp = bi.createPartFromItemStack( is );
if ( bp != null )
{
if ( bp instanceof IPartCable )
{
boolean canPlace = true;
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) )
canPlace = false;
if ( !canPlace )
return false;
return getPart( ForgeDirection.UNKNOWN ) == null;
}
else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN )
{
IPart cable = getPart( ForgeDirection.UNKNOWN );
if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) )
return false;
return getPart( side ) == null;
}